We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 91c6a28 commit 2d0e2b6Copy full SHA for 2d0e2b6
components/vc-picker/generate/dateFns.ts
@@ -23,6 +23,7 @@ import {
23
format as formatDate,
24
parse as parseDate,
25
isDate,
26
+ isMatch,
27
} from 'date-fns';
28
import * as Locale from 'date-fns/locale';
29
import type { GenerateConfig } from '.';
@@ -104,7 +105,7 @@ const generateConfig: GenerateConfig<Date> = {
104
105
const date = parseDate(formatText, format, new Date(), {
106
locale: Locale[dealLocal(locale)],
107
});
- if (isValid(date) && formatText.length === format.length) {
108
+ if (isValid(date) && isMatch(formatText, format)) {
109
return date;
110
}
111
0 commit comments