Output is NaN for a specific date format
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When I try to use dayjs with customParseFormat to parse a string like "20 Nov, 2022" to a date object, It is not able to parse it. I get NaN in return.
Code
` dayjs('20 Nov, 2022', DD MMM, YYYY').toDate()`
If i remove the comma, present after the Month name, It works fine.
**Expected behavior**
It should return a date object.
I am using it in a React Native Project.
**Information**
- Day.js Version = v1.11.0
- OS: = iOS
- Browser [e.g. chrome 62]
- Time zone: [e.g. GMT+05:30 IST (Indian Standard Time)]
Contributor guide
Research direction
Start at the customParseFormat plugin entry point and reproduce parsing of "20 Nov, 2022" alongside the comma-free form. Done means the comma-containing input returns a valid date object without regressing the existing format behavior; the issue names no source file or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100