| Issue 783: | formatDate('u') incorrectly outputs local times with UTC "Z" | |
| 2 people starred this issue and may be notified of changes. | Back to list |
When using the 'u' dateFormatter, a 'Z', indicating UTC, is always placed at the end of the string instead of the local time zone offset.
I modified the dateFormatters method, changing the u formatter and adding a TZO formatter, along with a new function zeroPadSign:
u : function(d) { return formatDate(d, "yyyy-MM-dd'T'HH:mm:ssTZO") },
TZO : function (d) {
var minOffset = d.getTimezoneOffset();
var hours = -1 * Math.floor(minOffset / 60);
var minutes = minOffset % 60;
var offset = zeroPadSign(hours) + ':' + zeroPad(minutes);
return offset;
}
function zeroPadSign(n) {
if (n >= 0) { return '+' + zeroPad(n); }
else { return '-' + zeroPad(Math.abs(n)); }
}
These add the proper offset (-07:00 for MNT here) to the string. I did not explicitly check if the date was in UTC however - I think the proper behavior would be to add the 'Z' for an explicit UTC date object, but an offset of -00:00 or +00:00 for anything else that has the same time as UTC (GMT is all I can think of), so that still would need to be added.
Using 1.4.10.
Brian
Feb 12, 2011
Project Member
#1
adamrs...@gmail.com
Status:
Discussing
Feb 15, 2011
(No comment was entered for this change.)
Summary:
formatDate for ISO8601 ('u') should include timezone offset
Status: Maybe
Aug 13, 2013
(No comment was entered for this change.)
Summary:
ISO8601 in local time, for formatDate
(was: formatDate for ISO8601 ('u') should include timezone offset)
Status: Accepted Labels: Type-Feature
Aug 15, 2013
Issue 1327 has been merged into this issue.
Aug 15, 2013
as @zippidyzap points out in issue 1327 , this is more of a "bug" than a feature request because the "Z" represent UTC time, and this function falsely represents that. All the values in the output are simply the local values, with a Z appended. Bad.
Summary:
formatDate('u') incorrectly outputs local times with UTC "Z"
(was: ISO8601 in local time, for formatDate)
Labels: -Type-Feature Type-Bug
Sep 1, 2013
(No comment was entered for this change.)
Labels:
milestone-date
May 25, 2014
this bug no longer applies in v2 (in github, v2 branch). not yet officially released though
Status:
Implemented
Jun 2, 2014
version 2 has been released with this change. http://blog.arshaw.com/1/post/2014/06/fullcalendar-2-released.html
Status:
Released
|
|
| ► Sign in to add a comment |