I’m working on connecting Google Calendar API to a jQuery DatePicker widget. Everything runs smoothly on most browsers but IE is giving me headaches as always.
Here’s my current implementation:
$.ajax({
url: "https://www.google.com/calendar/feeds/[email protected]/public/full?alt=json",
type: "GET",
dataType: "json",
success: function(response, status) {
$.each(response.feed.entry, function(i, item) {
if(item.gd$when) {
var formatted_date = $.datepicker.formatDate('yymmdd', new Date(item.gd$when[0].startTime));
if (!(events_data.hasOwnProperty(formatted_date))) {
events_data[formatted_date] = new Array();
}
item.gd$when[0].displayTime = $.datepicker.formatDate('MM d, yy', new Date(item.gd$when[0].startTime));
events_data[formatted_date].push(item);
}
});
displayEvent(new Date());
$('#my-datepicker').datepicker("refresh");
}
});
The issue is that Internet Explorer handles timezone conversion differently than other browsers. It applies the user’s local timezone when parsing the date strings from Google Calendar, but the calendar data isn’t in local time.
I heard about using a ctz parameter for custom timezone handling in the API call, but documentation seems sparse. Has anyone dealt with this IE timezone issue before? What’s the best way to ensure consistent date handling across all browsers when working with Google Calendar feeds?