You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I could tack the problem down: the comma is not a character that is identified as a separator in customParseFormat plugin.
@iamkun is there a special reason, why comma (or other special characters) are not defined as 'separator' characters in formattingTokens? And why the dot character defined in formattingTokens as separator character is not included in the const matchWord used to parse words (like the name of a month)?
I can easily create a pr for this issue; it is only to add the comma to the 2 constants mentioned above.
I also added some tests to 'customParseFormat.test.js' to identify the problem and to verify the solution.
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
The text was updated successfully, but these errors were encountered: