isValid bug
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Executed below code.
```js
const dayjs = require('dayjs');
console.log(dayjs('2024-00-02T04:57:02Z').isValid());
console.log(dayjs('2024-02-31T22:03:08Z').isValid());
console.log(dayjs('2024-02-31T22:03:08Z', 'YYYY-MM-DDTHH:mm:ssZ', true).isValid());
```
result
```
false
true
true
```
February 2024 has only 29 days, not 31.
`dayjs('2024-02-31T22:03:08Z').isValid()` should return `false`.
**Expected behavior**
```
false
false
false
```
**Information**
- Day.js Version [e.g. v1.0.0]: v1.11.10
- OS: [e.g. iOS]: Ubuntu 20.04, Windows 10
- Browser [e.g. chrome 62]: Nope. Node.js 18
- Time zone: [e.g. GMT-07:00 DST (Pacific Daylight Time)]: GMT +00:00
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the three Node.js examples from the issue and compare their isValid results with the expected values. Trace the date-parsing and validation entry points involved; done means invalid calendar dates such as February 31 are rejected consistently in both non-strict and strict parsing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100