#3228·dayjs

Saved localeData objects mix languages after changing the global locale

Author: xu91102Created Sep 26, 2026Updated Sep 26, 2026

Describe the bug

A saved global localeData() object mixes languages after the global locale changes. Its week-start and formats retain the original locale, but its month and weekday lists follow the new global locale.

javascript
dayjs.extend(localeData)
dayjs.locale('fr') // import dayjs/locale/fr first
const french = dayjs.localeData()
dayjs.locale('en')
console.log(french.months()[0]) // January (expected janvier)
console.log(french.firstDayOfWeek()) // 1, still French

Expected behavior

The saved object should consistently describe its selected locale, as the instance dayjs().locale('fr').localeData() API does. The standalone dayjs.months() API should still follow the current global locale.

Information

  • Reproduced against dev commit 436bde0bcded312781cbe45dc2b0ef079a36d8e3 on macOS / Node.js, Asia/Shanghai.
  • Regression reproduced in the existing localeData Jest suite; baseline passes, new assertion fails with January instead of janvier.
  • Investigated with OpenAI Codex assistance.