CustomParseFormat plugin does not work correctly when passing date in Vietnamese locale (vi)
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
CustomParseFormat plugin does not work correctly when passing date in Vietnamese locale. I am trying to convert a date in Vietnamese locale. It is giving 'Invalid date' object.
**Expected behavior**
It should parse the date correctly.
**Information**
- Day.js Version [1.11.8]
- OS: [iOS]
- Browser [chrome 114.0]
- Time zone: Any time zone
Analysis:
In CustomParseFormat plugin, we are having a below regex which strips the numbers from the input. And then it is trying to validate it and showing as 'Invalid Date'
`const matchWord = /\d*[^-_:/,()\s\d]+/ // Word`
In my case, I am trying to pass the input with Vietnamese locale like below and getting invalid date object.
`dayjs("01 Th09, 2019", 'DD MMM, YYYY')`
We should remove this decimal check for months (MMM) regex in the expressions object to make it work properly.
Attaching the vietnamese locales screenshot below.
Contributor guide
Research direction
Start in the CustomParseFormat plugin at the matchWord regex and the expressions object described in the issue. Reproduce the failure with dayjs("01 Th09, 2019", 'DD MMM, YYYY') under the Vietnamese locale, then verify that the date parses correctly without breaking other month formats.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- internationalization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100