mymth / vanillajs-datepicker

A vanilla JavaScript remake of bootstrap-datepicker for Bulma and other CSS frameworks
MIT License
753 stars 155 forks source link

Is it possible to pass locales in Options? #118

Closed smalos closed 2 years ago

smalos commented 2 years ago

Is it possible to pass some "custom" locales in the options, something like this? What would be the correct syntax?

const datepicker = new Datepicker(elem, {
  locales :
 {
      days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
      daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
      daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
      months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
      monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
      today: "Today",
      clear: "Clear",
      titleFormat: "MM y"
    }
}); 
mymth commented 2 years ago

https://mymth.github.io/vanillajs-datepicker/#/i18n?id=adding-languages https://mymth.github.io/vanillajs-datepicker/#/i18n?id=custom-locale

smalos commented 2 years ago

Thanks, that helped.