iamkun / iamkun/dayjs

Output is NaN for a specific date format

Open
#1,852 1 comment 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**
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.