Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Datepicker in Chrome parses in incorrect format #2508

Closed
cdietze opened this issue Jul 24, 2014 · 3 comments
Closed

Datepicker in Chrome parses in incorrect format #2508

cdietze opened this issue Jul 24, 2014 · 3 comments

Comments

@cdietze
Copy link

cdietze commented Jul 24, 2014

I configured the dateFormat for the German style: dd.MM.yyyy
Now when I enter "1.2." it gets parsed as 2nd of January. Expected is 1st of Febuary.

Another example that is pretty confusing for a user:
"1.02.2015" -> February 1st, 2015
"01.02.2015" -> January 2nd, 2015

I already browsed the code a bit and the cause is falling back to new Date(viewValue) which behaves very different across browsers.
Firefox: new Date("1.2.") -> undefined
Chrome: new Date("1.2.") -> Tue Jan 02 2001 00:00:00 GMT+0100 (CET)
Safari: new Date("1.2.") -> undefined

This can be reproduced using the demo datepicker.

I suggest to remove the fallback and to only rely on the DateParser that's part of bootstrap. Or at least to make the fallback optional.

@scottybrown
Copy link

I agree. The fallback to new Date(viewValue) produces some very unexpected behavior. It also seems to use American date formatting (MM/DD/YYYY) which, given that our application is for Australia (DD/MM/YYYY), is almost always not what we want.

@wesleycho
Copy link
Contributor

Note, this is also related to #3159. This should be fixed when #3417 is merged.

@wesleycho wesleycho added this to the 0.13.0 milestone Mar 23, 2015
@wesleycho wesleycho self-assigned this Mar 23, 2015
@karianna
Copy link
Contributor

#3417 and #3159 were merged, so closing this

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

Successfully merging a pull request may close this issue.

5 participants