iamkun / iamkun/dayjs

String "cat-1" is a valid date

Open
#774 3 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**
`dayjs('cat-1').isValid()` returns `true`

**Expected behavior**
`dayjs('cat-1').isValid()` should return `false`

**Information**
- Day.js Version v1.8.19
- OS: MacOS Catalina
- Browser: Chrome Version 79.0.3945.88 (Official Build) (64-bit)
- Time zone: /

**UPDATE**
After a fast analysis, I found that Dayjs uses `Date` inside `parseDate` method and the problem is really inside `Date` indeed `new Date("cat-1")` returns `2000-12-31T23:00:00.000Z`.
After that, I think that Dayjs should manage this case.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.