vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.96k stars 6.96k forks source link

[Feature Request] v-date-input should allow to set a custom ISO 8601 date format (e.g. YYYY-MM-DD) #19996

Open ian-ng opened 5 months ago

ian-ng commented 5 months ago

Problem to solve

I want to uniform the date format to "YYYY-MM-DD" (ISO 8601 format) to avoid user mistakes. (current version is: mm/dd/yyyy, which is a confusing date format)

Proposed solution

adding a props like below: <v-date-input ... date-format="YYYY-MM-DD" />

EDM115 commented 5 months ago

https://github.com/vuetifyjs/vuetify/assets/82015596/499b6890-6f27-4935-91d1-9524ada570c3

As you can see, typing DD/MM/YYYY doesn't work, but typing MM/DD/YYYY will work but will then be displayed as DD/MM/YYYY.
Note that my system is in French, and browser in English. dunno if it affects the component's logic

ian-ng commented 5 months ago

2024-06-13_10-31-50.mp4 As you can see, typing DD/MM/YYYY doesn't work, but typing MM/DD/YYYY will work but will then be displayed as DD/MM/YYYY. Note that my system is in French, and browser in English. dunno if it affects the component's logic

I have looked into the component, it seems affected by the Vuetify locale setting.

Currently, I am showing the date input in the old way (v-menu + v-text-field + v-date-picker ), and handling the date format with v-text-field.

Sko007 commented 4 months ago

Would be a great feature. :)

jaketig commented 3 months ago

Workaround: If you change your locale to en-CA the dates will be formatted as YYYY-MM-DD by default. The placeholder is hardcoded to 'mm/dd/yyyy' still though.

createVuetify({
  locale: {
    locale: 'en-CA',
  },
})
gabystallo-zt commented 2 months ago

+1 this is a fundamental feature

hiadev commented 2 months ago

+1

KentuckyMC commented 1 month ago

This is indeed fundamental. Got the same behaviour as @EDM115 . It always shows mm/dd/yyyy. When entering it that way, for example: 02-01-2024. It will go to 2 January, it shows that way in the datepicker as well. And in the textfield it also shows 02-01-2024. That's the way we want it, I've combined vuetify with my Vue-i18n which works great. Also the calendar is showing in the right order, with Monday first.

Will be very nice it also understand that the placeholder is going with the dd/mm/yyyy way.

EvgenyVetrov commented 1 month ago

+1 must have date format parametr!

i need in dd.mm.yyyy format

tmedina92 commented 1 month ago

is there any news on this feature? is a very usefull one

etienne-monier commented 2 weeks ago

I agree !

Kartikeya-chatterbug commented 1 week ago

+ 1 waiting for this feature since my entire application depends on dates