Skip to content

Commit 2d0e2b6

Browse files
committed
fix: dateFns parse strict mode
1 parent 91c6a28 commit 2d0e2b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/vc-picker/generate/dateFns.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
format as formatDate,
2424
parse as parseDate,
2525
isDate,
26+
isMatch,
2627
} from 'date-fns';
2728
import * as Locale from 'date-fns/locale';
2829
import type { GenerateConfig } from '.';
@@ -104,7 +105,7 @@ const generateConfig: GenerateConfig<Date> = {
104105
const date = parseDate(formatText, format, new Date(), {
105106
locale: Locale[dealLocal(locale)],
106107
});
107-
if (isValid(date) && formatText.length === format.length) {
108+
if (isValid(date) && isMatch(formatText, format)) {
108109
return date;
109110
}
110111
}

0 commit comments

Comments
 (0)