icehaunter / vue3-datepicker

Simple datepicker component for Vue 3
https://icehaunter.github.io/vue3-datepicker/
MIT License
150 stars 153 forks source link

Updated inputFormat behavior to match documentation #33

Closed primogenito closed 3 years ago

primogenito commented 3 years ago

This update is for the inputFormat property of the datepicker. The update will make the expected behavior match the project's official documentation, https://icehaunter.github.io/vue3-datepicker/config.html#inputformat.

The existing behavior is limited to patterns supported by lightFormat, https://date-fns.org/v2.19.0/docs/fp/lightFormat. This update will allow a user to select any pattern permitted by format https://date-fns.org/v2.19.0/docs/format.

The existing locale object is now passed in as an option to format. This will give better international support. In my local tests, month names displayed in the input translated correctly to the two languages I tested, French and Spanish. I would run unit tests, but I'm not sure of the best way to run one for a datepicker.

If there any issues with this change, please let me know.

alesf commented 3 years ago

Fixes #26

icehaunter commented 3 years ago

I generally wanted to avoid format since it is heavier than lightFormat, but you're correct and that is a very valid use-case. Thank you for the contribution!