Eonasdan / tempus-dominus

A powerful Date/time picker widget.
https://getdatepicker.com
MIT License
7.16k stars 4.41k forks source link

Patterns of DateTime.fromString and DateTime.format are not aligned #2855

Closed solomax closed 8 months ago

solomax commented 10 months ago

Prerequisites

Describe the issue

DateTime.fromString can handle single y in the pattern https://github.com/Eonasdan/tempus-dominus/blob/master/src/js/datetime.ts#L767

While DateTime.format can't: https://github.com/Eonasdan/tempus-dominus/blob/master/src/js/datetime.ts#L921

So in case localization.format with single y is used (for ex. dd.MM.y, HH:mm:ss) The date can be parsed correctly BUT being set into input as 27.09.undefined, 14:47:41 on select

StackBlitz fork

https://codepen.io/solomax/pen/bGOeYKg

What operating system(s) are you seeing the problem on?

Linux

What browser(s) are you seeing the problem on?

Chrome, Firefox

What version of are you using? You can find this information from the sample StackBlitz.

6.7.11, 6.7.13

What your browser's locale? You can find this information from the sample StackBlitz.

en-US

stackblitz[bot] commented 10 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

solomax commented 10 months ago

I believe the fix is trivial :)

single y should be handled exactly as yyyy :)))

Eonasdan commented 9 months ago

New release should fix this.