motss / app-datepicker

Datepicker element built with Google's lit and Material Design 2021
https://npm.im/app-datepicker
MIT License
180 stars 51 forks source link

Date format breaks in the new Chrome v58 #80

Closed akhilgopi007 closed 7 years ago

akhilgopi007 commented 7 years ago

Before updating chrome, selecting date used to show proper date format. But now the date is shown in a weird way with month denoted by number instead. PFA before and after Chroime update.

Before correct value

After

screen shot 2017-04-27 at 6 42 02 pm
motss commented 7 years ago

@rip-the-jacker

Need for info:

  1. Affected OS version
  2. Browser language
  3. Polymer version
  4. Affected app-datepicker version
  5. A reduced test case to reproduce the issue.
akhilgopi007 commented 7 years ago
motss commented 7 years ago

Will look into it in depth to see if it can be reproduced.

sp1rs commented 7 years ago

@rip-the-jacker Just added locale='en' and it worked fine for me.

akhilgopi007 commented 7 years ago

@sp1rs Thanks that works.

motss commented 7 years ago

@rip-the-jacker

Tested the issue throughly on all browsers on latest macOS and was unable to reproduce the issue.

Yell at me again for persistent issue.

Thank you for reporting. 😄 Thank you @sp1rs for the solution 🎉 .

akhilgopi007 commented 7 years ago

@motss I had set format="". Maybe that's what caused it.

motss commented 7 years ago

Hmm...that's could be what worth looking into.

sp1rs commented 7 years ago

The issue is .. Chrome: 57 : window.Intl.DateTimeFormat().resolvedOptions().locale ==> 'en-gb' Chrome 58 : window.Intl.DateTimeFormat().resolvedOptions().locale ==> 'und'

And i just updated the chrome from 57 to 58. Somehow the locale changed.

@motss, Can we have check that if locale is undefined 'und' than use 'en' as default.

motss commented 7 years ago

@sp1rs Strange enough. Mine is still en-US.

sp1rs commented 7 years ago

@motss Did you updated the chrome to 58?

motss commented 7 years ago

@sp1rs Tested on Chrome 58, 59, 60 and all returned en-US.

sp1rs commented 7 years ago

@motss Still, if window.Intl.DateTimeFormat().resolvedOptions().locale returns und then code should handle this case.

motss commented 7 years ago

@sp1rs Indeed. This is definitely needed to be fixed.

sp1rs commented 7 years ago

@motss I was about to create a pull request, but you fixed it.