iamkun / iamkun/dayjs

Invalid date while parsing `YYYYMMMDD` or `DDMMMYYYY`

Open
#2,371 5 comments 2 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**
All the following inputs give `Invalid Date` as output:
- `dayjs("2023NOV01")`
- `dayjs("01NOV2023")`
- `dayjs("01NOV2023", "DDMMMYYYY")`
- `dayjs("2023NOV2023", "YYYYMMMDD")`

Works as expected on Chrome and Node
Works as expected for:
- `dayjs("2023-NOV-01")`
- `dayjs("01-NOV-2023")`
- `dayjs("01-NOV-2023", "DD-MMM-YYYY")`
- `dayjs("2023-NOV-2023", "YYYY-MMM-DD")`

**Expected behavior**
Expected to return a valid dayjs object.

**Information**
- Day.js Version 1.11.9 and 1.10.7
- OS: OSX
- Browser Firefox and Safari
- Time zone: EDT (East Daylight Time)

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.