Localization

Dozens of locales are available.

flatpickr can be localized per-instance, or globally.

Using Modules

ES modules (if your environment supports it)

  1. import flatpickr from "flatpickr"
  2. import { Russian } from "flatpickr/dist/l10n/ru.js"
  3. flatpickr(myElem, {
  4. "locale": Russian // locale for this instance only
  5. });

Using plain require()

  1. const flatpickr = require("flatpickr");
  2. const Russian = require("flatpickr/dist/l10n/ru.js").default.ru;
  3. flatpickr(myElem, {
  4. "locale": Russian // locale for this instance only
  5. });

Localize globally (for all instances):

  1. const Russian = require("flatpickr/dist/l10n/ru.js").default.ru;
  2. // or import { Russian } from "flatpickr/dist/l10n/ru.js"
  3. flatpickr.localize(Russian); // default locale is now Russian
  4. flatpickr(myElem);

Localization in a Browser Environment

  1. <script src="https://npmcdn.com/flatpickr/dist/flatpickr.min.js"></script>
  2. <script src="https://npmcdn.com/flatpickr/dist/l10n/ru.js"></script>
  1. flatpickr(myElement, {
  2. "locale": "ru" // locale for this instance only
  3. });

Localize globally (for all instances):

  1. flatpickr.localize(flatpickr.l10ns.ru);
  2. 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:

  1. 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:

  1. flatpickr(myElem, {
  2. locale: {
  3. firstDayOfWeek: 2
  4. }
  5. });