#1849·dayjs

Format doesn't add a leading zero if the year is three digits

Author: derawCreated Apr 9, 2022Updated Sep 28, 2026

Describe the bug Hi, the dayjs().format() function doesn't add a leading zero if the year is three digits.

Expected behavior

javascript
dayjs('0999-01-01').format('YYYY-MM-DD'); // Returns '999-01-25' instead of '0999-01-25'

Information

  • Day.js Version: 1.11.0
  • OS: Windows 11
  • Browser: Chrome 100
  • Time zone: UTC+2 Europe/Paris