mymth / vanillajs-datepicker

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

Is it possible to pass locales in Options? #118

Closed smalos closed 1 year ago

smalos commented 1 year 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 1 year ago

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

smalos commented 1 year ago

Thanks, that helped.