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());
Neither moment nor dayjs have a parsing token dddd; so parsing with a format of dddd, MMMM D, YYYY h:mm A creates an invalid date (see also issue #1789).
When parsing dates using the following format:
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.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