Dates with years with 5 digits do not round-trip
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
`dayjs(dayjs('20222-02-02').format())` is invalid date.
**Expected behavior**
`dayjs(dayjs('20222-02-02').format())` should be the same as `dayjs('20222-02-02')`.
`dayjs('+020222-02-03T00:00:00.000')` works -- if there's something I can pass to `format` to make it format ISO 8601 if the year is less than 10k, and otherwise like this, that would be a good workaround.
**Information**
- Day.js Version: 1.10.6
- OS: Ubuntu
- Browser: Node
- Time zone: GMT
Contributor guide
Research direction
Start by reproducing the round-trip in Node with dayjs('20222-02-02').format() and the resulting parser call. Trace the format and parse entry points for extended years, then verify that formatting and reparsing produce the same date, including the existing +020222 ISO form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100