Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14360

iOS: relativeOffSet in Calendar event does not return correct value greater than 2073600000 (24 days in mili seconds)

    Details

      Description

      Calendar-Event-Alert, relativeOffset value set greater than 24 days, does not work correctly when try to get the value.

      Steps to reproduce:

      1: Use the below code and copy paste that in app.js of a sample project.
      2: launch the app (simulator/device) and press the calendar button.
      3: check the console for Ti.API.info.

      Correct Result will be printed if value is till 24 days (example value for 24 days).
      [INFO] : alert1 before: 604800000 // i set 7 days
      [INFO] : alert1 after : -604800000 // i get 7 days
      [INFO] : alert2 before: 2073600000 // i set 24 days
      [INFO] : alert2 after : 2073600000 // i get 24 days

      if value is greater than 24 days then (example values for 26 days)
      [INFO] : alert1 before: 604800000 // i set 7 days
      [INFO] : alert1 after : -604800000 // i get 7 days
      [INFO] : alert2 before: 2246400000 // i set 26 days
      [INFO] : alert2 after : -2147483648 // i get -2147483648 as fixed value.

      var win = Ti.UI.createWindow({
      	backgroundColor:"gray"
      });
       
      var btn = Ti.UI.createButton({
      	title:"calendar",
      	top:10,
      	height:100,
      	width:250,
      	left:10
      });
       
      btn.addEventListener("click",function(){
      	
      	if (Ti.Calendar.eventsAuthorization == Ti.Calendar.AUTHORIZATION_AUTHORIZED) {
          test_alerts();
      } else {
          Ti.Calendar.requestEventsAuthorization(function(e){
                  if (e.success) {
                      test_alerts();
                  } else {
                      alert('Access to calendar is not allowed');
                  }
              });
      }
       
      function test_alerts()
      {
          var ical = Ti.Calendar.defaultCalendar;
          var start_date = new Date();
       
      var event = ical.createEvent({
          title: 'Test event1',
          begin: start_date,
          end: new Date(start_date.getTime() + 15*60*1000),
          availability: Ti.Calendar.AVAILABILITY_FREE,
          allDay: false
      });
       
      var millis = 7*24*60*60*1000;
      Ti.API.info('alert1 before: ' + millis);
      var alert1 = event.createAlert({
          relativeOffset:-millis //5 days before
      });
      Ti.API.info('alert1 after : ' + alert1.relativeOffset);
       
      var millis2 = 26*24*60*60*1000;
      Ti.API.info('alert2 before: ' + millis2);
      var alert2 = event.createAlert({
          relativeOffset:-millis2 //26 days before,
      });
      Ti.API.info('alert2 after : ' + alert2.getRelativeOffset()); // value should be similar to alert2 before value
       
      event.alerts = [alert1, alert2];
      event.save(Ti.Calendar.SPAN_FUTUREEVENTS);
      }
      	
      });
       
       
      win.add(btn);
       
      win.open();
      
      

        Attachments

          Activity

            People

            • Assignee:
              vduggal Vishal Duggal (Inactive)
              Reporter:
              anigam Ashish Nigam
              Reviewer:
              Sabil Rahim
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-16840
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code