mengxiong10 / vue2-datepicker

A datepicker / datetimepicker component for Vue2
https://mengxiong10.github.io/vue2-datepicker/index.html
MIT License
1.51k stars 405 forks source link

[Feature request] setting format when setting a locale #438

Open colorcube opened 4 years ago

colorcube commented 4 years ago

What problem does this feature solve?

When setting a locale like

  import 'vue2-datepicker/locale/de';
  DatePicker.locale('de');

it would be nice to set the format automatically.

For example for the de locate the date format would be

DD.MM.YYYY

instead of

YYYY-MM- DD

This is especially useful when your app is multilanguage and you can't set the format to a fixed value.

Enrica-r commented 3 years ago

This information could be in each local .js settings file. The notation could be similar then in the INTL specs.

Example for 'de': short = 'DD.MM.YYYY' => (14.01.2021) medium = 'DD. MMM YYYY => (14. Jan 2021) long = 'D. MMMM YYYY' => (1. Januar 2021) full = 'dddd, D. MMMM YYYY' => (Freitag, 1. Januar 2021)

Attention: en-US and en-GB is different! (US short: MM/DD/YYYY while GB short: DD/MM/YYYY).

Instead of defining all defintions in local files this component could use Luxon library which is based on Javascript intl (icu standard). see Intl page of Luxon

This must have influence on visible input element only. The standard output format for value-type format and token should be ISO with or without time.

mattias-palm commented 2 years ago

Very much this. The internationalization is rather pointless without it.