Loading the customParseFormat plugin causes parsing some formats to return invalid dates
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
When parsing dates using the following format:
```
dddd, MMMM D, YYYY h:mm A
```
parsing works correctly until you load the customParseFormat plugin at which point parsing of the date no longer works. For example, using the following code formatting the date to the huge format and then parsing it does not work. If you remove this line: `dayjs.extend(window.dayjs_plugin_customParseFormat);` then it works as expected.
```
// if you don't load this plugin the parsing works as expected
dayjs.extend(window.dayjs_plugin_customParseFormat);
const hugeFormat = 'dddd, MMMM D, YYYY h:mm A';
// format as huge
const hugeFeb16 = dayjs('2022-02-16').format(hugeFormat);
console.log(hugeFeb16);
// parse huge formatted expecting to be valid
console.log(dayjs(hugeFeb16, hugeFormat, false).isValid());
```
https://jsfiddle.net/mcgraphix/2qk5t61m/7/
**Expected behavior**
I would expect that the addition of the plugin would not break parsing of other formats
**Information**
- Day.js Version 1.10.1
- OS: Mac
- Browser Chrome 97
- Time zone: EST
Contributor guide
Assessment
This issue has not been assessed yet.