Locales
Locales customize the language-specific strings used in date formatting and parsing — month names, day-of-week names, and AM/PM indicators. By default, the library uses English (en). To use another language, import the corresponding locale module and pass it as the locale option.
import { format, parse } from 'date-and-time';import es from 'date-and-time/locales/es';
const date = new Date('2025-08-23T12:00:00');
format(date, 'MMMM D, YYYY', { locale: es });// => agosto 23, 2025
format(date, 'ddd, D MMM', { locale: es });// => sáb, 23 agoSupported Locales
The following 41 locales are available:
ar (Arabic)
import ar from 'date-and-time/locales/ar';az (Azerbaijani)
import az from 'date-and-time/locales/az';bn (Bengali)
import bn from 'date-and-time/locales/bn';cs (Czech)
import cs from 'date-and-time/locales/cs';da (Danish)
import da from 'date-and-time/locales/da';de (German)
import de from 'date-and-time/locales/de';el (Greek)
import el from 'date-and-time/locales/el';en (English)
import en from 'date-and-time/locales/en';es (Spanish)
import es from 'date-and-time/locales/es';fa (Persian)
import fa from 'date-and-time/locales/fa';fi (Finnish)
import fi from 'date-and-time/locales/fi';fr (French)
import fr from 'date-and-time/locales/fr';he (Hebrew)
import he from 'date-and-time/locales/he';hi (Hindi)
import hi from 'date-and-time/locales/hi';hu (Hungarian)
import hu from 'date-and-time/locales/hu';id (Indonesian)
import id from 'date-and-time/locales/id';it (Italian)
import it from 'date-and-time/locales/it';ja (Japanese)
import ja from 'date-and-time/locales/ja';ko (Korean)
import ko from 'date-and-time/locales/ko';ms (Malay)
import ms from 'date-and-time/locales/ms';my (Burmese)
import my from 'date-and-time/locales/my';nl (Dutch)
import nl from 'date-and-time/locales/nl';no (Norwegian)
import no from 'date-and-time/locales/no';pl (Polish)
import pl from 'date-and-time/locales/pl';pt-BR (Brazilian Portuguese)
import ptBR from 'date-and-time/locales/pt-BR';pt-PT (European Portuguese)
import ptPT from 'date-and-time/locales/pt-PT';ro (Romanian)
import ro from 'date-and-time/locales/ro';ru (Russian)
import ru from 'date-and-time/locales/ru';rw (Kinyarwanda)
import rw from 'date-and-time/locales/rw';sr-Cyrl (Serbian Cyrillic)
import srCyrl from 'date-and-time/locales/sr-Cyrl';sr-Latn (Serbian Latin)
import srLatn from 'date-and-time/locales/sr-Latn';sv (Swedish)
import sv from 'date-and-time/locales/sv';ta (Tamil)
import ta from 'date-and-time/locales/ta';th (Thai)
import th from 'date-and-time/locales/th';tr (Turkish)
import tr from 'date-and-time/locales/tr';uk (Ukrainian)
import uk from 'date-and-time/locales/uk';uz-Cyrl (Uzbek Cyrillic)
import uzCyrl from 'date-and-time/locales/uz-Cyrl';uz-Latn (Uzbek Latin)
import uzLatn from 'date-and-time/locales/uz-Latn';vi (Vietnamese)
import vi from 'date-and-time/locales/vi';zh-Hans (Simplified Chinese)
import zhHans from 'date-and-time/locales/zh-Hans';zh-Hant (Traditional Chinese)
import zhHant from 'date-and-time/locales/zh-Hant';