Internationalization support with 51+ built-in locales and customizable locale objects for global applications.
// Import specific locale
import { French } from "flatpickr/dist/l10n/fr.js";
import { German } from "flatpickr/dist/l10n/de.js";
import { Spanish } from "flatpickr/dist/l10n/es.js";
// Use in instance
flatpickr("#date-fr", {
locale: French,
dateFormat: "d/m/Y"
});
// Use by key (if locale is already loaded)
flatpickr("#date-de", {
locale: "de"
});Flatpickr includes 51+ built-in locales:
ar - Arabicar-dz - Arabic (Algeria)at - Austrian Germanaz - Azerbaijanibe - Belarusianbg - Bulgarianbn - Bengalibs - Bosniancat - Catalanckb - Central Kurdishcs - Czechcy - Welshda - Danishde - Germandefault - English (default)eo - Esperantoes - Spanishet - Estonianfa - Persianfi - Finnishfo - Faroesefr - Frenchga - Irishgr - Greekhe - Hebrewhi - Hindihr - Croatianhu - Hungarianhy - Armenianid - Indonesianis - Icelandicit - Italianja - Japaneseka - Georgiankm - Khmerko - Koreankz - Kazakhlt - Lithuanianlv - Latvianmk - Macedonianmn - Mongolianms - Malaymy - Myanmarnl - Dutchnn - Norwegian Nynorskno - Norwegianpa - Punjabipl - Polishpt - Portuguesero - Romanianru - Russiansi - Sinhalask - Slovaksl - Sloveniansq - Albaniansr - Serbiansv - Swedishth - Thaitr - Turkishuk - Ukrainianuz - Uzbekuz-latn - Uzbek (Latin)vn - Vietnamesezh - Chinesezh-tw - Chinese (Traditional)interface Locale {
weekdays: {
shorthand: [string, string, string, string, string, string, string];
longhand: [string, string, string, string, string, string, string];
};
months: {
shorthand: [string, string, string, string, string, string, string, string, string, string, string, string];
longhand: [string, string, string, string, string, string, string, string, string, string, string, string];
};
daysInMonth: [number, number, number, number, number, number, number, number, number, number, number, number];
firstDayOfWeek: number;
ordinal: (nth: number) => string;
rangeSeparator: string;
weekAbbreviation: string;
scrollTitle: string;
toggleTitle: string;
amPM: [string, string];
yearAriaLabel: string;
monthAriaLabel: string;
hourAriaLabel: string;
minuteAriaLabel: string;
time_24hr: boolean;
}weekdays: {
shorthand: [string, string, string, string, string, string, string];
longhand: [string, string, string, string, string, string, string];
};Weekday names starting from Sunday (index 0).
Example (French):
weekdays: {
shorthand: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"],
longhand: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"]
}months: {
shorthand: [string, string, string, string, string, string, string, string, string, string, string, string];
longhand: [string, string, string, string, string, string, string, string, string, string, string, string];
};Month names from January (index 0) to December (index 11).
Example (Spanish):
months: {
shorthand: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
longhand: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]
}daysInMonth: [number, number, number, number, number, number, number, number, number, number, number, number];
firstDayOfWeek: number;daysInMonth: Days in each month (February adjusted for leap years automatically)firstDayOfWeek: First day of week (0=Sunday, 1=Monday, etc.)rangeSeparator: string;
weekAbbreviation: string;
scrollTitle: string;
toggleTitle: string;
amPM: [string, string];rangeSeparator: Text between dates in range mode (default: " to ")weekAbbreviation: Week number label (default: "Wk")scrollTitle: Tooltip for scroll interaction (default: "Scroll to increment")toggleTitle: Tooltip for AM/PM toggle (default: "Click to toggle")amPM: AM/PM labels (default: ["AM", "PM"])yearAriaLabel: string;
monthAriaLabel: string;
hourAriaLabel: string;
minuteAriaLabel: string;ARIA labels for screen readers.
ordinal: (nth: number) => string;
time_24hr: boolean;ordinal: Function returning ordinal suffix (1st, 2nd, 3rd, etc.)time_24hr: Default 24-hour time format preferencetype CustomLocale = Partial<Locale>;Partial locale object for customization.
const customLocale = {
months: {
shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
},
weekdays: {
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
},
firstDayOfWeek: 1, // Monday
rangeSeparator: " - ",
time_24hr: true
};
flatpickr("#custom-locale", {
locale: customLocale
});import { French } from "flatpickr/dist/l10n/fr.js";
const customFrench = {
...French,
rangeSeparator: " → ",
firstDayOfWeek: 1 // Override to Monday
};
flatpickr("#custom-french", {
locale: customFrench
});flatpickr.localize: (l10n: CustomLocale) => void;Sets global default locale for all new instances.
import { German } from "flatpickr/dist/l10n/de.js";
// Set German as global default
flatpickr.localize(German);
// All new instances will use German
flatpickr("#date1");
flatpickr("#date2");flatpickr.l10ns: { [k in LocaleKey]?: CustomLocale } & { default: Locale };Collection of all loaded locales.
// Access loaded locales
console.log(flatpickr.l10ns.default); // English locale
console.log(flatpickr.l10ns.fr); // French (if loaded)
// Add custom locale to collection
flatpickr.l10ns.myCustom = {
months: { /* ... */ },
weekdays: { /* ... */ }
};import { French } from "flatpickr/dist/l10n/fr.js";
import { German } from "flatpickr/dist/l10n/de.js";
import { Spanish } from "flatpickr/dist/l10n/es.js";
const userLang = navigator.language.split('-')[0];
const locales = {
'fr': French,
'de': German,
'es': Spanish
};
flatpickr("#date", {
locale: locales[userLang] || 'default',
dateFormat: "d/m/Y"
});import { Arabic } from "flatpickr/dist/l10n/ar.js";
flatpickr("#date-rtl", {
locale: Arabic,
dateFormat: "Y-m-d"
});
// Add RTL CSS
document.querySelector('.flatpickr-calendar').style.direction = 'rtl';const businessLocale = {
firstDayOfWeek: 1, // Monday first
weekdays: {
shorthand: ["S", "M", "T", "W", "T", "F", "S"],
longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
},
rangeSeparator: " through ",
ordinal: (nth) => {
const s = nth % 100;
if (s > 3 && s < 21) return "th";
switch (s % 10) {
case 1: return "st";
case 2: return "nd";
case 3: return "rd";
default: return "th";
}
}
};
flatpickr("#business-date", {
locale: businessLocale,
dateFormat: "F jS, Y"
});type LocaleKey =
| "ar" | "ar-dz" | "at" | "az" | "be" | "bg" | "bn" | "bs" | "cat"
| "ckb" | "cs" | "cy" | "da" | "de" | "default" | "eo" | "es"
| "et" | "fa" | "fi" | "fo" | "fr" | "ga" | "gr" | "he" | "hi"
| "hr" | "hu" | "hy" | "id" | "is" | "it" | "ja" | "ka" | "km"
| "ko" | "kz" | "lt" | "lv" | "mk" | "mn" | "ms" | "my" | "nl"
| "nn" | "no" | "pa" | "pl" | "pt" | "ro" | "ru" | "si" | "sk"
| "sl" | "sq" | "sr" | "sv" | "th" | "tr" | "uk" | "uz"
| "uz-latn" | "vn" | "zh" | "zh-tw";Union type of all available locale keys.