Angular.js: Angular date filter in IE

Created on 29 Jan 2016  路  6Comments  路  Source: angular/angular.js

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.

Edge IE10 IE11 IE8 IE9 filters low broken expected use bug

Most helpful comment

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

All 6 comments

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.

Fantastic. I appreciate the detailed response.

@gkalpak what release is this in?

@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).

No probs.

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

Was this page helpful?
0 / 5 - 0 ratings