Day and month are switched on manual input #2728
-
Prerequisites
Describe the issueWhen using manual input, the day and month get switched Reproducible on https://getdatepicker.com/6/repl.html on multiple computers Windows settings:
Additional: StackBlitz forkhttps://tempus-dominus-v6-simple-setup-6fwhut.stackblitz.io/ Just a fork of the default HTML, no edits done What operating system(s) are you seeing the problem on?Windows What browser(s) are you seeing the problem on?Microsoft Edge What version of are you using? You can find this information from the sample StackBlitz.6.2.7 What your browser's locale? You can find this information from the sample StackBlitz.en-US |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
JS date objects are constructed in |
Beta Was this translation helpful? Give feedback.
-
Thanks for the comment. |
Beta Was this translation helpful? Give feedback.
-
In javascript if you create a data e.g. That plugin might be rolling into the main picker but I haven't had time to do that. |
Beta Was this translation helpful? Give feedback.
-
Ok. I can confirm that using customDateFormat plugin the input/output is consistent. |
Beta Was this translation helpful? Give feedback.
In javascript if you create a data e.g.
new Date('07/12/2022')
the date will be July 11, 2022. The old date picker used momentjs to attempt to handle formats that where noten-US
format. In order reduce the external dependencies (and momentjs is no longer being updated), I opted to make use of the native JS date object and Intl. However, neither of those support providing custom format parsing. There are ways to provide custom parsing on your own or use the customDateFormat plugin.That plugin might be rolling into the main picker but I haven't had time to do that.