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

Date filter still giving incorrect date #2098

Closed
ChrisBauer opened this issue Mar 4, 2013 · 3 comments
Closed

Date filter still giving incorrect date #2098

ChrisBauer opened this issue Mar 4, 2013 · 3 comments

Comments

@ChrisBauer
Copy link

Related to #1240

This is still an issue for incomplete dates that do not include a time or timezone. (i.e. 2012-06-18). While it is the "expected behavior", when supporting multiple applications it is unwieldy and potentially troublesome to have to append something like T00:00:00Z to every date. @groner has a great solution (comment in issue #1240) - is there any chance of rolling such a filter into angular's core to fix this?

See the forked fiddle for reference: http://jsfiddle.net/5m9B7/3/

In this fiddle, both 2012-06-18 nor 2012-06-18T00:00:00 are filtered to the wrong date (06/17/2012). It's worth noting, since it was mentioned that this may be a problem in time zones east of GMT, that I am in a timezone west of GMT

@pkozlowski-opensource
Copy link
Member

@ChrisBauer Parsing dates without a timezone specified as local date was only fixed in 1.1.2:
https://github.com/angular/angular.js/blob/master/CHANGELOG.md#112-tofu-animation-2013-01-22

Could you check this jsfiddle and confirm that it works for you?
http://jsfiddle.net/eDSVW/

@ChrisBauer
Copy link
Author

@pkozlowski-opensource That fiddle does work. I'm currently running 1.0.4 and must have missed that in the changelog when I was looking to see if it had been fixed. Thanks for the response!

@officiallyandy
Copy link

I dunno, maybe I'm doing something wrong but I still get the error if I reference it using javascript, using this format: $filter('date')(date[, format]).

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

3 participants