dayjs("02-29") return “2001-03-01”
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
In chrome and nodejs, dayjs("02-29") return “2001-03-01”.
**Expected behavior**
I think "02-29" should be a invalid input.
In firefox, this cause a error "Invalid Date". It's OK.
In chrome, the dafault year "2001" makes it even worse.
There is no "2001-02-29", but chrome/v8 makes it to be "2001-03-01".
It's certainly wrong. (Maybe also a bug to v8.)
**Information**
- Day.js Version 1.11.10
- OS: windows 7 - 10
- Browser chrome 109.0.5414.120 - 122.0.6261.95
- Time zone: GMT+0800 Asia/Shanghai
Contributor guide
Research direction
Start by reproducing dayjs("02-29") in Chrome and Node.js, then trace the date-parsing entry point responsible for the result. The issue is done when this input is rejected as invalid consistently rather than normalized to 2001-03-01, with coverage for the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100