Many issues with dates under year 100 (0099 ... 0001, 0000, -0001, -0002, ...)
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
I found many issues when manipulating dates under year 100, starting with year 99
**Issues with date parsing**
`dayjs("0099-01-02").format("YYYY-MM-DD")` returns `"1999-01-02"`, expected `"0099-01-02"`
same for years 0098 to 0001
`dayjs().date(1).month(0).year(-88).format("YYYY-MM-DD")` => `"0-88-01-01"`, expected `"-0088-01-01"` (that's how momentjs format it anyway)
**startOf issues**
`dayjs().date(1).month(0).year(99).startOf("year").format("YYYY-MM-DD")` returns `"1999-01-01"`, expected `"0099-01-01"`
same with years 0098 to 0001
note: `dayjs().date(1).month(0).year(99).format("YYYY-MM-DD")` returns `"0099-01-01"`, so it's not a formatting issue
There are probably more issues like these
Awesome lib by the way, thanks !
**Information**
- Day.js Version 1.11.10
- OS: macos 14.0, Apple Pro M1
- Browser: Chrome Version 121.0.6167.139 (Official Build) (arm64)
- Time zone: Central European Standard Time (GMT+1)
Contributor guide
Research direction
Start by reproducing the documented examples for date parsing, year(), format(), and startOf("year") with years below 100. Trace those entry points to compare their handling of years 0099 through negative years. Done means the reported examples produce the expected year values without regressing the formatting behavior that already works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100