iamkun / iamkun/dayjs

dayjs ctor casts string ID value into Date now or Date with 8590 year...

Open
#2,261 0 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**
I have value: any;
It cointains string '859100000000000001'.
Calling dayjs(value).isValid() returns true. The cause of proble, that dayjs parsed it as:
![image](https://user-images.githubusercontent.com/23425714/226599989-2652b58d-f93d-4f57-bbb0-73c87294f598.png)

I suppose bug in the parseDate method. Fiddle example where it returns new Date() for this value:
https://jsfiddle.net/c83kadq2/1/

**Expected behavior**
dayjs('859100000000000001').isValid() returns false.

**Information**
- Day.js Version ^1.11.5
- OS: Windows 10 21H2
- Browser Microsoft Edge Version 111.0.1661.44
- Time zone: GMT+1 Prague

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the linked JSFiddle for dayjs('859100000000000001') and inspect the parseDate method. Confirm that the value is currently treated as a valid Date, then verify that isValid() returns false for this input without changing normal date parsing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.