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

Date filter gives wrong day for ISO8601 date #1240

Closed
AgentShark opened this issue Aug 8, 2012 · 2 comments
Closed

Date filter gives wrong day for ISO8601 date #1240

AgentShark opened this issue Aug 8, 2012 · 2 comments

Comments

@AgentShark
Copy link

Got {{'2012-08-10T00:00:00Z'|date:'d'}} = 9
Expected = 10

Angular 1.0.1

@groner
Copy link
Contributor

groner commented Aug 9, 2012

Because the JavaScript Date object represents a local time, this will happen in timezones east of GMT.

Changing the timezone to local would fix this.

Here is a filter you can use to dynamically add the local offset to date strings with no timezone.
http://jsfiddle.net/8Ru6r/1/

#1073 proposes making date strings without a timezone default to the local timezone. If this were fixed you would only need to get rid of the Z.

@pkozlowski-opensource
Copy link
Member

@AgentShark as explained by @groner this is expected behavior as Date object are converted to a local time zone in JS. The referenced issue #1073 was fixed in master already (will make it into the next release). Closing.

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

No branches or pull requests

3 participants