iamkun / iamkun/dayjs

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

Open
#1,849 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.