Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dayjs says "invalid date" or swaps day and month on European date format #1536

Open
sagedemdreisbusch opened this issue Jun 17, 2021 · 4 comments

Comments

@sagedemdreisbusch
Copy link

Describe the bug
When using a European date format, dayjs does not recognize the format and signs it as invalid date on Safari and Firefox.
When using Chrome dayjs recognizes the date but is then swapping day and month.
Link to codesandbox: https://codesandbox.io/s/mystifying-microservice-olpl6?file=/src/App.js

Expected behavior
Dayjs should recognize the European date format in Chrome and also Safari / Mac

Information

  • Day.js Version 1.10.5
  • OS: MacOS Big Sur, Windows 10
  • Browser Safari 14.1.1, Chrome 91.0.4472.106, Firefox 68.4.1esr
  • Time zone: Europe / Berlin, GMT+1

ceae6399-ebca-47c1-8744-c0ce259f2e17
Bildschirmfoto 2021-06-17 um 13 57 57
Bildschirmfoto 2021-06-17 um 13 57 31

@sagedemdreisbusch
Copy link
Author

Also in vanilla this error occurs: https://codesandbox.io/s/priceless-dawn-5u4en?file=/src/index.js

@bornova
Copy link

bornova commented Jun 21, 2021

Hi @sagedemdreisbusch,
You need to use the CustomParseFormat plugin:
https://codesandbox.io/s/eloquent-franklin-mvl7e

@smshahiran-mnrb
Copy link

Same goes to 'DD/MM/YYYY' format. Just writing this here for other developer reference.

@archfz
Copy link

archfz commented Nov 28, 2021

Why can't this be builtin into dayjs?

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

No branches or pull requests

4 participants