A date that looks perfectly natural to one reader can look strange, or even misleading, to another. A British visitor reads 03/04/2026 as the third of April; an American reads it as the fourth of March. A German expects “15. November 2026”, while a Japanese reader expects “2026年11月15日”. Weeks begin on Sunday in some countries and on Monday in others. Internationalisation is how software respects these differences, and Dayjs supports it through 143 locales that you load only when you need them. This guide explains how locales work, how to load and switch them, how to customise them and how to avoid the common pitfalls.
What a Dayjs locale contains
A locale is a small object describing the conventions of a language or region. It typically includes:
- Month and weekday names in full, short and minimal forms.
- Ordinal rules, such as “1st” in English or “1er” in French.
- Relative-time phrases such as “in %s” and “%s ago”.
- Localised format patterns used by tokens such as
LandLLL. - The first day of the week and, for some locales, the rules for the first week of the year.
- A meridiem function for languages with their own morning and afternoon terms.
English is built into the core. Every other locale is a separate file, which keeps the default bundle small and ensures you pay only for the languages you serve.
Loading locales in Dayjs
With a bundler or Node.js
Import the locale file by its code. Importing registers the locale; it does not activate it.
import dayjs from 'dayjs'
import 'dayjs/locale/fr'
import 'dayjs/locale/de'
import 'dayjs/locale/ur'
Locale codes follow common conventions: two letters for a language, such as fr, and a hyphenated region where variants differ, such as en-gb, pt-br or zh-cn. You can browse the full list inside the locale folder of the package, or in the source archive available from our download section.
In the browser via CDN
Locale scripts can be loaded directly after the core script. Each registers itself under a global named dayjs_locale_ followed by the code with hyphens replaced by underscores.
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/locale/es.js"></script>
<script>dayjs.locale('es')</script>
Changing the locale globally
Calling dayjs.locale(code) sets the default locale for every instance created afterwards. This suits applications with a single language per session.
dayjs.locale('fr')
dayjs('2026-11-15').format('dddd D MMMM YYYY')
// 'dimanche 15 novembre 2026'
The function returns the code of the active locale, so dayjs.locale() with no argument tells you which locale is currently in use. Set the global locale once during application start-up, ideally in the setup module described in our installation guide, and update it whenever the user changes their language preference.
Changing the locale for a single instance
Sometimes a page must show several languages at once, for example a travel itinerary with local times for each destination, or an admin view that previews customer emails in their language. The instance method .locale(code) returns a copy that uses a different locale without affecting the global setting.
const d = dayjs('2026-11-15')
d.locale('de').format('D. MMMM YYYY') // '15. November 2026'
d.locale('es').format('D [de] MMMM') // '15 de noviembre'
d.format('D MMMM') // global locale unchanged
Because instances are immutable, this approach is entirely safe in shared code. Each call produces a new value with its own locale, leaving the original untouched.
Locale-aware formatting and relative time
Locales influence far more than month names. With the LocalizedFormat plugin, tokens such as L, LL and LLL expand to the patterns each locale prefers, giving natural output without hard-coding day-month order. Our formatting guide lists these shortcuts in full.
dayjs.extend(localizedFormat)
dayjs('2026-11-15').locale('en').format('L') // '11/15/2026'
dayjs('2026-11-15').locale('en-gb').format('L') // '15/11/2026'
dayjs('2026-11-15').locale('de').format('L') // '15.11.2026'
Relative time also follows the locale. With RelativeTime loaded, fromNow() returns “il y a 3 heures” in French and “hace 3 horas” in Spanish, with correct grammatical forms for each language. The relative time and durations guide covers this output in depth.
Week starts and week numbering
Locales define which day begins the week. This affects startOf('week'), endOf('week') and the Weekday plugin. In the default English locale, weeks begin on Sunday; in en-gb, de, fr and many others, they begin on Monday.
dayjs('2026-11-18').startOf('week').format('ddd D') // 'Sun 15'
dayjs('2026-11-18').locale('en-gb').startOf('week').format('ddd D') // 'Mon 16'
If your product requires ISO week behaviour regardless of language, which is common in business reporting, use the IsoWeek plugin and startOf('isoWeek'). That keeps reporting consistent even when the interface language changes. These distinctions matter in calendars, timesheets and analytics, where an inconsistent week boundary can shift totals between periods.
Customising a locale with UpdateLocale
Built-in locales cover standard conventions, but products often have their own voice. The UpdateLocale plugin lets you modify any property of an existing locale.
import updateLocale from 'dayjs/plugin/updateLocale'
dayjs.extend(updateLocale)
dayjs.updateLocale('en', {
weekStart: 1,
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June',
'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec']
})
Common customisations include changing the week start, adjusting abbreviated month names to match a style guide and rewording relative phrases. Apply them once in your setup module so they take effect everywhere.
Reading locale data
When building custom pickers or dropdowns, you may need lists of month or weekday names rather than formatted dates. The LocaleData plugin exposes these directly.
import localeData from 'dayjs/plugin/localeData'
dayjs.extend(localeData)
dayjs.locale('fr')
dayjs.months() // ['janvier', 'février', ...]
dayjs.weekdaysShort() // ['dim.', 'lun.', ...]
dayjs.localeData().firstDayOfWeek() // 1
Using locale data ensures that your custom components stay consistent with formatted output, and that adding a new language requires no change to component code.
Choosing a locale for each visitor
A practical strategy combines several signals. Start with an explicit preference stored in the user's profile. If none exists, consult the browser's navigator.language, normalise it to lower case and check whether a matching locale is available. Fall back to the language alone, so that fr-ca becomes fr if necessary, and finally to a sensible default such as en-gb.
For applications with many languages, load locale files on demand with dynamic imports, so a visitor reading in Portuguese never downloads the Korean locale.
async function useLocale(code) {
await import(`dayjs/locale/${code}.js`)
dayjs.locale(code)
}
Locales and time zones are different things
A frequent misunderstanding is to assume that setting a locale changes the time zone. It does not. A locale controls language and conventions; a time zone controls which clock time corresponds to an instant. A user in Dubai may read English while living in the Gulf Standard Time zone. Keep these settings separate in your data model and interface, and handle zones with the techniques in our time zones and UTC guide.
Right-to-left languages and numbering systems
Some locales, such as Arabic, Persian, Hebrew and Urdu, are written from right to left. Dayjs produces correctly localised month and weekday names for these languages, but layout direction is the responsibility of your HTML and CSS. Set the dir attribute on the relevant element and test formatted dates inside real sentences to confirm that punctuation and numerals appear in the expected order.
Certain locales also use their own numeral systems. The PreParsePostFormat plugin allows a locale to convert digits during formatting and parsing, so that dates can appear with native numerals where readers expect them. If your audience prefers Western digits even when reading in their own language, which is common in technical products, you can adjust this behaviour through UpdateLocale.
Testing localised output
Localisation bugs are rarely caught by automated tests unless you write tests specifically for them. A small table-driven test that formats the same fixed date in every supported locale, using both explicit patterns and LocalizedFormat shortcuts, gives quick confidence that nothing has regressed. Include relative-time output as well, since plural rules are a frequent source of surprises.
Native speakers remain the best reviewers. Before launching in a new market, ask a colleague or translator to review screens that show dates, particularly calendars and notification text. Their feedback often reveals conventions that no automated check would catch, such as a preference for abbreviated month names in tight spaces or a particular way of writing times.
Finally, document which locales your product supports and how they are chosen. Clear documentation prevents well-meaning additions that download unnecessary files and keeps behaviour consistent as the team grows.
Conclusion
Internationalisation in Dayjs is efficient and flexible. With 143 locales available as separate files, you load only the languages your audience needs, set them globally or per instance and rely on LocalizedFormat and RelativeTime to produce natural output. UpdateLocale tailors wording and week starts to your style, while LocaleData feeds custom components. Keep language and time zone as separate settings, choose locales from clear signals and your dates will feel native to every reader, in every market you serve.