Localization
Dozens of locales are available.
flatpickr can be localized per-instance, or globally.
Using Modules
ES modules (if your environment supports it)
import flatpickr from "flatpickr"
import { Russian } from "flatpickr/dist/l10n/ru.js"
flatpickr(myElem, {
"locale": Russian // locale for this instance only
});
Using plain require()
const flatpickr = require("flatpickr");
const Russian = require("flatpickr/dist/l10n/ru.js").default.ru;
flatpickr(myElem, {
"locale": Russian // locale for this instance only
});
Localize globally (for all instances):
const Russian = require("flatpickr/dist/l10n/ru.js").default.ru;
// or import { Russian } from "flatpickr/dist/l10n/ru.js"
flatpickr.localize(Russian); // default locale is now Russian
flatpickr(myElem);
Localization in a Browser Environment
<script src="https://npmcdn.com/flatpickr/dist/flatpickr.min.js"></script>
<script src="https://npmcdn.com/flatpickr/dist/l10n/ru.js"></script>
flatpickr(myElement, {
"locale": "ru" // locale for this instance only
});
Localize globally (for all instances):
flatpickr.localize(flatpickr.l10ns.ru);
flatpickr("mySelector");
You may also wish to modify only certain values of locale.For instance, to set the first day of the week to Monday:
flatpickr.l10ns.default.firstDayOfWeek = 1; // Monday
If you’d like the option to persist regardless of locale, use the locale
option to override specific fields:
flatpickr(myElem, {
locale: {
firstDayOfWeek: 2
}
});