freqdec / datePicker

An attempt at writing a flexible, framework free, feature-rich and accessible datepicker
http://freqdec.github.io/datePicker/
MIT License
171 stars 56 forks source link

Manual input interpreted differently between chrome and other browsers #40

Closed dasjestyr closed 10 years ago

dasjestyr commented 10 years ago

When a date such as 7/10/14 is entered into a textbox, datePicker changes it to 7-10-2014 in Chrome but changes it to 7-10-1914 in IE 11 and Firefox

freqdec commented 10 years ago

Hi,

This is due to the fact that I fallback to parsing the input using the browsers Date Object. Here's the relevant comments from the code:

Last ditch attempt at date parsing for single inputs that represent the day, month and year parts of the date format. I'm - thankfully - passing this responsibility off to the browser. Date parsing in js sucks but the browsers' in-built Date.parse method will inevitably be better than anything I would hazard to write. Date.parse is implementation dependant though so don't expect consistency, rhyme or reason.

dasjestyr commented 10 years ago

Ok, I was starting to figure as much. Do you have any recommendations? I'm thinking in terms of accessibility. I'm away from my desk for a while so I can't test this right now, but will using %Y instead of %y enforce a 4 digit year for manual input? If not, do you think that could be a reasonable compromise?

freqdec commented 10 years ago

Hi,

I don't know if there is a way around the two digit year problem apart from splitting the date across three distinct form elements and offering the year part in a selectlist (not a great solution I'll openly admit). Setting a "%Y" format is perhaps better but users need to be aware that a 4 digit year is required in this case... really, there are no easy solutions!

On Sun, Jul 13, 2014 at 11:08 PM, Jeremy Stafford notifications@github.com wrote:

Ok, I was starting to figure as much. Do you have any recommendations? I'm thinking in terms of accessibility. I'm away from my desk for a while so I can't test this right now, but will using %Y instead of %y enforce a 4 digit year for manual input? If not, do you think that could be a reasonable compromise?

— Reply to this email directly or view it on GitHub https://github.com/freqdec/datePicker/issues/40#issuecomment-48851977.

dasjestyr commented 10 years ago

Ok fair enough. Maybe just consider it an enhancement that may or may never be implemented lol.