| Issue 280: | Set timezone of calendar to something other than local timezone | |
| 6 people starred this issue and may be notified of changes. | Back to list |
I need to be able to set the timezone of the calendar to an arbitrary zone that may not be the same as the "local" timezone of the user. I don't see an option for this in the docs, is it possible? Can any core devs comment on how easy or difficult it would be for me to add this option?
Jan 10, 2010
#1
jared%ja...@gtempaccount.com
Jan 19, 2010
hi jared, right now fullcalendar is timezone-agnostic. it ignores any gmt offsets, so if you set a time to 6pm in any time zone, it will always display 6pm. so the timezone of the displayed events ends up being determined by the way the times are outputted in your feed. adjust them to the timezone you want when you output the feed. if this server-side approach isn't enough for you, maybe a client-side javascript approach could be considered
Jan 20, 2010
@adamrshaw: Thanks for the response. I'm a little confused, you mean I can return events from the server in any timezone I wish? How do I make an event display at 6pm, regardless of the local timezone? I'm not sure this is possible currently, as the times given for events by the server will be translated into the local timezone before being displayed. In order the "correct" for this on the server-side I would need to know the local timezone and adjust for that, giving a time which was offset by the difference between the local timezone and my target timezone. For example, lets say the user's local timezone is set to PST (-0800), but they want to view the calendar in SAST (+0200). I would have to add 10hours to all times returned by the server, right? This is less than ideal since it is a function of the users local timezone, so its kind of a kludge. Is there any way to do this that isn't a function of the user's local timezone?
Feb 5, 2010
you might be overthinking it. a date like "2010-01-01T09:00:00" will be parsed by fullcalendar's own date parsing function into a Date. this date will have the same year/month/date/hour/minutes values in all client timezones. you are right, the date object will have a timezone associated with it, but this is just ignored by fullcalendar and should be ignored by your scripts. the above date will turn into... Fri Jan 01 2010 09:00:00 GMT-0800 (PST) Fri Jan 01 2010 09:00:00 GMT-0800 (MST) Fri Jan 01 2010 09:00:00 GMT-0800 (XYZ) Fri Jan 01 2010 09:00:00 GMT-0800 (whatever) and will be displayed as 9 o clock on in any browser in any timezone please let me know if you have any questions or run into any quirks. thanks
Status:
Done
Mar 8, 2011
I was having a similar issue with Fullcalendar adjusting the display of my datetime values based on the client timezone setting. I was using the unix timestamp option for shuttling dates to Fullcalendar in a JSON feed. I changed the date format to ISO 8601 without a timezone, and now Fullcalendar displays events exactly as I send them -- no more adjusting the display. In my experience, you have to provide an ISO 8601 date to get the behavior documented here: http://arshaw.com/fullcalendar/docs/event_data/ignoreTimezone/
Jul 28, 2011
http://arshaw.com/fullcalendar/docs/event_data/Event_Object/ param "start" [can be] a string in ISO8601 format (ex: "2009-11-05T13:15:30Z") bug: if some other timezone (ex: "2011-07-28T10:15:00A") is entered the event object is ignored; ommiting the timezone component does work. very nice program ;) regards, Ingmar
Jan 4, 2012
I am using fullcalendar 1.5.2 and I have a problem once I parse an ISO08601 from the server side I am always getting a different and incorrect time. Please note that I am using ASP.NET C# and I want to ignore the time zone local. I am getting the events from the database that has a start date and end date then I parsed that to get ISO format by using DateTime.ToString ( "s", System.Globalization.CultureInfo.InvariantCulture ). but with no luck Please help
Jan 12, 2012
I am too getting this bug.I am using ASP.NET C# and I want to ignore the time zone local. for ex: the below given value that is taken from db start:Wed Jan 11 11:00:00 UTC+0530 2012 but while displaying in calendar it is showing 04:30pm the actual output should be 11:00 am i tried by setting the ignoretimezone:true but it is giving no effect. Please help me.
Jan 17, 2012
I was getting this bug and my date was a number, I found a solution that modify the function parseDate to this:
function parseDate(s, ignoreTimezone) { // ignoreTimezone defaults to true
if (typeof s == 'object') { // already a Date object
return s;
}
if (typeof s == 'number') { // a UNIX timestamp
if(ignoreTimezone == true){
var lclDate = new Date(s * 1000);
return new Date(lclDate.valueOf() + ( lclDate.getTimezoneOffset() * 60 *1000 ));
}
else{
return new Date(s * 1000);
}
}
if (typeof s == 'string') {
if (s.match(/^\d+(\.\d+)?$/)) { // a UNIX timestamp
return new Date(parseFloat(s) * 1000);
}
if (ignoreTimezone === undefined) {
ignoreTimezone = true;
}
return parseISO8601(s, ignoreTimezone) || (s ? new Date(s) : null);
}
// TODO: never return invalid dates (like from new Date(<string>)), return null instead
return null;
}
|
|
| ► Sign in to add a comment |