Calendar-PhoneGap-Plugin
Calendar-PhoneGap-Plugin copied to clipboard
time is off
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)
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)
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 .
This give me the same issue, Android and IOS provide different time.
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 .
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 .
Sounds like this recent PR causes it..
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.
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.
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
}
);
Hope it helps!