Format doesn't add a leading zero if the year is three digits
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Hi, the `dayjs().format()` function doesn't add a leading zero if the year is three digits.
**Expected behavior**
```js
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
Contributor guide
Research direction
The reported entry point is dayjs().format(); start by reproducing the YYYY-MM-DD example with the supplied 0999-01-01 value. Confirm that the year is padded to four digits while the month and day remain unchanged, then check the project's existing formatting tests for the appropriate place to capture the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100