Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

date filter not adding appropriate + / - sign for 'Z' timezone offset resulting in invalid ISO 8601 #1532

Closed
ghost opened this issue Nov 6, 2012 · 4 comments

Comments

@ghost
Copy link

ghost commented Nov 6, 2012

See jsfiddle example here: http://jsfiddle.net/traeregan/C82QB/

e.g. the output I get in EDT is:
2012-11-06T01:29:290500

But it should be:
2012-11-06T01:29:29-0500

@pkozlowski-opensource
Copy link
Member

Hmm, just tested in CET (UTC+1) and properly getting 2012-11-23T23:06:19-0100.

@ghost
Copy link
Author

ghost commented Nov 24, 2012

Still incorrect for my timezone per the fiddle above.

@pkozlowski-opensource
Copy link
Member

@TraeRegan I think you are right, there is something fishy going on here... According to http://en.wikipedia.org/wiki/ISO_8601:

The offset from UTC is given in the format ±[hh]:[mm], ±[hh][mm], or ±[hh]. So if the time being described is one hour ahead of UTC (such as the time in Berlin during the winter), the zone designator would be "+01:00", "+0100", or simply "+01".

and then

To calculate UTC time one has to subtract the offset from the local time, e.g. for "15:00-03:30" do 15:00 − (−03:30) to get 18:30 UTC.

So in my case (GMT+1) it looks like it should be giving 2012-11-23T23:06:19+0100 while it gives 2012-11-23T23:06:19-0100. It looks like the sign is flipped, there is a similar issue opened already for this: #1261

On top of this the + sign is never added.

latentflip added a commit to latentflip/angular.js that referenced this issue Jan 30, 2013
This commit fixes angular#1261 and angular#1532. This covers
two separate issues:

- Positive timezones were being formatted without
a leading `+` resulting in a formatting string
like: "HH:MM:ssZ" giving "12:13:141000" instead
of "12:13:14+1000". Fixed by checking if timezone
is > 0 and adding a leading "+".

- Timezone output signs were inverted.
mock.TzDate expects the timezone _offset_ as it's
first argument, _not_ the timezone. This means
that a mock.TzDate with a positive offset should
result in a date string with a negative timezone,
and vice-versa.
latentflip added a commit to latentflip/angular.js that referenced this issue Jan 30, 2013
This commit fixes angular#1261 and angular#1532. This covers
two separate issues:

- Positive timezones were being formatted without
a leading `+` resulting in a formatting string
like: "HH:MM:ssZ" giving "12:13:141000" instead
of "12:13:14+1000". Fixed by checking if timezone
is > 0 and adding a leading "+".

- Timezone output signs were inverted.
mock.TzDate expects the timezone _offset_ as it's
first argument, _not_ the timezone. This means
that a mock.TzDate with a positive offset should
result in a date string with a negative timezone,
and vice-versa.
latentflip added a commit to latentflip/angular.js that referenced this issue Feb 3, 2013
This commit fixes angular#1261 and angular#1532. This covers
two separate issues:

- Positive timezones were being formatted without
a leading `+` resulting in a formatting string
like: "HH:MM:ssZ" giving "12:13:141000" instead
of "12:13:14+1000". Fixed by checking if timezone
is > 0 and adding a leading "+".

- Timezone output signs were inverted.
mock.TzDate expects the timezone _offset_ as it's
first argument, _not_ the timezone. This means
that a mock.TzDate with a positive offset should
result in a date string with a negative timezone,
and vice-versa.
IgorMinar pushed a commit to IgorMinar/angular.js that referenced this issue Feb 7, 2013
This commit fixes angular#1261 and angular#1532. This covers
two separate issues:

- Positive timezones were being formatted without
a leading `+` resulting in a formatting string
like: "HH:MM:ssZ" giving "12:13:141000" instead
of "12:13:14+1000". Fixed by checking if timezone
is > 0 and adding a leading "+".

- Timezone output signs were inverted.
mock.TzDate expects the timezone _offset_ as it's
first argument, _not_ the timezone. This means
that a mock.TzDate with a positive offset should
result in a date string with a negative timezone,
and vice-versa.

Closes angular#1261, angular#1532
IgorMinar pushed a commit that referenced this issue Feb 7, 2013
This commit fixes #1261 and #1532. This covers
two separate issues:

- Positive timezones were being formatted without
a leading `+` resulting in a formatting string
like: "HH:MM:ssZ" giving "12:13:141000" instead
of "12:13:14+1000". Fixed by checking if timezone
is > 0 and adding a leading "+".

- Timezone output signs were inverted.
mock.TzDate expects the timezone _offset_ as it's
first argument, _not_ the timezone. This means
that a mock.TzDate with a positive offset should
result in a date string with a negative timezone,
and vice-versa.

Closes #1261, #1532
@IgorMinar
Copy link
Contributor

fixed by b001c8e

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants