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

Angular date filter in IE #13880

Closed
shavo007 opened this issue Jan 29, 2016 · 6 comments
Closed

Angular date filter in IE #13880

shavo007 opened this issue Jan 29, 2016 · 6 comments

Comments

@shavo007
Copy link

Hi,

I have an issue with date filter and timezone in IE 11.

I created a plunker.
http://plnkr.co/FzVbYl

The filter is not formatting the date-time based on the timezone.

Example, if you change your system time and run the plunker, the time is the local time of browser. Which is incorrect.

This works btw in chrome, safari and firefox.

@gkalpak
Copy link
Member

gkalpak commented Jan 29, 2016

Basically, this is an IE/Edge bug:

When Date.parse-ing a date string, they don't recognize the timezone in the format +HH:mm (but only without the :). According to the spec, the timezone should contain :.
The ISO 8601 Standard allows both forms (with and without :). Although the Date implementation in JavaScript does not 100% follow the ISO 8601 Standard (it's just based on it), all other browsers seem to recognize both forms as well.

Typically this is a browser bug, but since it should be easy to work-around, I believe this is worth fixing in Angular itself.

@shavo007, in the meantime, you can remove the : from timezone offset (i.e. replace +09:30 with +0930) to work make it work consistently across browsers.

gkalpak added a commit to gkalpak/angular.js that referenced this issue Jan 29, 2016
…set contains `:`

When `Date.parse`-ing a date string, IE and Edge don't recognize the timezone offset in the format
`+HH:mm` (but only without the `:`). According to [the spec][1], the timezone offset should
contain `:`. The [ISO 8601 Standard][2] allows both forms (with and without `:`).
Although the `Date` implementation in JavaScript does not 100% follow the ISO 8601 Standard (it's
just _based on it_), all other browsers seem to recognize both forms as well.

[1]: http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15
[2]: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC

Fixes angular#13880
gkalpak added a commit that referenced this issue Jan 29, 2016
…set contains `:`

When `Date.parse`-ing a date string, IE and Edge don't recognize the timezone offset in the format
`+HH:mm` (but only without the `:`). According to [the spec][1], the timezone offset should
contain `:`. The [ISO 8601 Standard][2] allows both forms (with and without `:`).
Although the `Date` implementation in JavaScript does not 100% follow the ISO 8601 Standard (it's
just _based on it_), all other browsers seem to recognize both forms as well.

[1]: http://www.ecma-international.org/ecma-262/5.1/#sec-15.9.1.15
[2]: https://en.wikipedia.org/wiki/ISO_8601#Time_offsets_from_UTC

Fixes #13880

Closes #13887
@shavo007
Copy link
Author

shavo007 commented Feb 1, 2016

Fantastic. I appreciate the detailed response.

@shavo007
Copy link
Author

shavo007 commented Feb 1, 2016

@gkalpak what release is this in?

@gkalpak
Copy link
Member

gkalpak commented Feb 1, 2016

@shavo007, this has been fixed in master. It will be in the upcoming 1.5.0 and 1.4.10 releases (although I'm not sure about the exact release dates).

@shavo007
Copy link
Author

shavo007 commented Feb 1, 2016

No probs.

@edupes
Copy link

edupes commented May 4, 2017

MICROSOFT LOVES STANDARDS. AS LONG AS THE ARE MADE BY THEM

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