haoxins / react-flatpickr

flatpickr for React
MIT License
598 stars 102 forks source link

Using 'locale' togerther with 'firstDayOfWeek' #87

Closed Kafty closed 5 years ago

Kafty commented 5 years ago

Hey :) I found out I need to use locale together with the firstDayOfWeek.. And I can't figure out how to specify it in the options prop. Can you help me please ? Thanks :)

jacobmischka commented 5 years ago

Does this in the options object not work? https://flatpickr.js.org/localization/

{
    locale: {
        firstDayOfWeek: 2
    }
}
Kafty commented 5 years ago

this works perfectly fine, but I would like to do something like this:

{
    locale: l10n.sk,
    locale: {
        firstDayOfWeek: 2
    }
}

and I didn't find the way to do that. If that would be possible, would be great

jacobmischka commented 5 years ago

Locales are just objects, so using a spread or Object.assign should work to override the default for the locale:

{
    locale: {
        ...l10n.sk,
        firstDayOfWeek: 2
    }
}
Kafty commented 5 years ago

that's fantastic ! Thanks so much 👍