fix: datefns & dayjs parse strict, close #5221
parent
5d38b3cf8d
commit
8f9875e518
|
@ -104,7 +104,7 @@ const generateConfig: GenerateConfig<Date> = {
|
|||
const date = parseDate(formatText, format, new Date(), {
|
||||
locale: Locale[dealLocal(locale)],
|
||||
});
|
||||
if (isValid(date)) {
|
||||
if (isValid(date) && formatText.length === format.length) {
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,13 +101,13 @@ const generateConfig: GenerateConfig<Dayjs> = {
|
|||
parseNoMatchNotice();
|
||||
return null;
|
||||
}
|
||||
const date = dayjs(formatText, format).locale(localeStr);
|
||||
const date = dayjs(formatText, format, true).locale(localeStr);
|
||||
if (date.isValid()) {
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
||||
if (text) {
|
||||
if (!text) {
|
||||
parseNoMatchNotice();
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue