Calendar-PhoneGap-Plugin icon indicating copy to clipboard operation
Calendar-PhoneGap-Plugin copied to clipboard

time is off

Open tpharaoh opened this issue 9 years ago • 9 comments

Hi, I created an event, set it to: 2016,1,1,18,0,0,0,0 2016,1,1,19,0,0,0,0

so it should be 6pm to 7pm. In iPhone its correct. In Android it sets 8pm-9pm (I am in GMT+2 timezone)

tpharaoh avatar Jul 05 '16 19:07 tpharaoh

Similar issue for me: Create an event: Start: July 02, 2016 19:45:00 End: July 02, 2016 22:00:00

In iPhone it's correct, (19:45 to 22:00) Android it sets to 20:45 to 23:00

I am in UK, date is in BST, (GMT+1)

iiukadmin avatar Jul 06 '16 08:07 iiukadmin

Javascript date allows a string, has anyone tried it? Wed Jul 06 2016 14:26:01 GMT+0200 (EET)

I don't particularily like this option, because the the needed stuff in the string.

On 6 July 2016 at 11:56, iiukadmin [email protected] wrote:

Similar issue for me: Create an event: Start: July 02, 2016 19:45:00 End: July 02, 2016 22:00:00

In iPhone it's correct, (19:45 to 22:00) Android it sets to 20:45 to 23:00

I am in UK, date is in BST, (GMT+1)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/issues/308#issuecomment-230716108, or mute the thread https://github.com/notifications/unsubscribe/ACy6_NRIatS0AYmg3j3NyM6dXouH1ayUks5qS224gaJpZM4JFcZa .

tpharaoh avatar Jul 06 '16 12:07 tpharaoh

This give me the same issue, Android and IOS provide different time.

iiukadmin avatar Jul 06 '16 14:07 iiukadmin

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-globalization/

We could get timezone of android. Any better ideas? On Jul 6, 2016 4:22 PM, "iiukadmin" [email protected] wrote:

This give me the same issue, Android and IOS provide different time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/issues/308#issuecomment-230786862, or mute the thread https://github.com/notifications/unsubscribe/ACy6_I22xeilcWIFdE7ZIxqKO24804unks5qS7oVgaJpZM4JFcZa .

tpharaoh avatar Jul 06 '16 16:07 tpharaoh

This is my quick and dirty solution, but it works. Obviously if my timezone is +2, I need to set the original time -2 and phone will add 2... annoying but it works. Still open to better ideas. Note: my function is pulling calendar entry from a link, which explains why I do it the

if(device.platform=='Android'){ navigator.globalization.getDatePattern( function (date) { var dateOffset=date.utc_offset; if(dateOffset>0){ dateOffset=Math.abs(dateOffset) * -1; }else{ dateOffset=Math.abs(dateOffset) * 1; }

      startTime[0]=parseInt(startTime[0])+parseInt(dateOffset/60/60);

      endTime[0]=parseInt(endTime[0])+parseInt(dateOffset/60/60);
      var startDate = new

Date(YYYY,MM,DD,startTime[0],startTime[1],0,0,0); var endDate = new Date(endYYYY,endMM,endDD,endTime[0],endTime[1],0,0,0);

window.plugins.calendar.createEventInteractively(title,eventLocation,notes,startDate,endDate,success,error);

    },
    function () { alert('Error getting pattern\n'); },
    { formatLength: 'full', selector: 'date and time' }

);

}

On 6 July 2016 at 19:48, Tim S [email protected] wrote:

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-globalization/

We could get timezone of android. Any better ideas? On Jul 6, 2016 4:22 PM, "iiukadmin" [email protected] wrote:

This give me the same issue, Android and IOS provide different time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/issues/308#issuecomment-230786862, or mute the thread https://github.com/notifications/unsubscribe/ACy6_I22xeilcWIFdE7ZIxqKO24804unks5qS7oVgaJpZM4JFcZa .

tpharaoh avatar Jul 07 '16 16:07 tpharaoh

Sounds like this recent PR causes it..

EddyVerbruggen avatar Jul 07 '16 17:07 EddyVerbruggen

thanks tpharaoh, I've gone with a similar workaround, I have a set of events published via a webservice to the app, creates a list of events in the app, with links for "add to your calendar". if the request comes from an android device, I'm adjusting the time accordingly in my webservice feed.

iiukadmin avatar Jul 08 '16 08:07 iiukadmin

EddyVerbruggen - I did think that, but tried setting phonegap build to an earlier version, and still had the issue. I am using createinteractivly to trigger the plugin.

iiukadmin avatar Jul 08 '16 08:07 iiukadmin

Calendar shift timezone date issue (Ionic example)

let startDate = '2021-04-01T19:00:00';
let endDate = '2021-04-01T22:00:00';

const clearShift = (date) => {
    date = new Date(date);
      return new Date(
        this.platform.is('ios') ? 
        date.getTime() + (date.getTimezoneOffset() * 60000) 
        : date.getTime()
      );
}

this.calendar.createEventInteractivelyWithOptions(
      'My event', 'Location name', 'Description', 
      clearShift(startDate), 
      clearShift(endDate), 
      { 
        url: 'https://myevent.com', 
        firstReminderMinutes: 15 
       }
);
Screen Shot 2019-09-04 at 01 44 10

Hope it helps!

roman-rr avatar Sep 03 '19 18:09 roman-rr