It is not possible to manually input a date with year less than 1000, except by adding a leading 0. However, this zero gets immediately removed, so it is necessary to add it again and again every time to input another year < 1000.
Adding dateFormat='dd/mm/yy' does not fix it either. This pattern does not actually print the date on four digits as stated in the docs. The reason why is here: https://github.com/primefaces/primevue/blob/master/packages/primevue/src/datepicker/DatePicker.vue#L1375). output += lookAhead('y') ? date.getFullYear() : ... should probably be replaced by output += lookAhead('y') ? `${date.getFullYear()}`.padStart(4, '0') : ....
Same problem for years Y less than 100, but the year also jumps automatically to 1900 + Y or 2000 + Y, which is actually undesired in some situations. It's the same for UI input, i.e. non-manual.
Same problem with date having year more than 9999. No way to manually input such a date, it gets ignored. However, dates in JS can go up to year 275 760.
Describe the bug
It is not possible to manually input a date with year less than 1000, except by adding a leading 0. However, this zero gets immediately removed, so it is necessary to add it again and again every time to input another year < 1000.
Adding
dateFormat='dd/mm/yy'
does not fix it either. This pattern does not actually print the date on four digits as stated in the docs. The reason why is here: https://github.com/primefaces/primevue/blob/master/packages/primevue/src/datepicker/DatePicker.vue#L1375).output += lookAhead('y') ? date.getFullYear() : ...
should probably be replaced byoutput += lookAhead('y') ? `${date.getFullYear()}`.padStart(4, '0') : ...
.Same problem for years
Y
less than 100, but the year also jumps automatically to 1900 +Y
or 2000 +Y
, which is actually undesired in some situations. It's the same for UI input, i.e. non-manual.Same problem with date having year more than 9999. No way to manually input such a date, it gets ignored. However, dates in JS can go up to year 275 760.
Reproducer
https://stackblitz.com/edit/primevue-4-vite-issue-template-8hhozk?file=src%2FApp.vue
PrimeVue version
3.53.0, 4.0.5
Vue version
3.x
Language
ALL
Build / Runtime
Vite
Browser(s)
ALL
Steps to reproduce the behavior
Using the plain date picker (for example in the docs page)
Expected behavior