iamkun / iamkun/dayjs

dayjs constructor returns "Invalid Date" in the Browser, but valid date in Node.js

Open
#2,954 2 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**

In Chrome:

```js
dayjs('11/1/2004', 'MM/DD/YYYY')
// ^ Invalid Date
```

In Node.js
```js
dayjs('11/1/2004', 'MM/DD/YYYY')
// ^ 2004-11-01T04:00:00.000Z
```

**Expected behavior**

The behavior should be the same in both environments

**Information**
- Day.js Version 1.11.3
- OS: macOS 15.6.1 (Sequoia)
- Browser: Chrome 142.0.7444.60
- Node: v22.19.0
- Time zone: GMT-04:00 DST

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied dayjs('11/1/2004', 'MM/DD/YYYY') case in Chrome and Node.js using the reported versions and time zone. Trace the constructor's date parsing path and verify that the same valid result is produced in both environments; add or run coverage for the browser and Node.js cases if the repository provides it.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.