fix: inferPickerType (#6244)

This commit is contained in:
Katherine 2025-02-19 10:16:49 +08:00 committed by GitHub
parent dcd2279eeb
commit 1955499178
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -271,7 +271,7 @@ function withParams(value: any[], params: { fieldOperator?: string; isParsingVar
return value;
}
export function inferPickerType(dateString: string, picker): 'year' | 'month' | 'quarter' | 'date' {
export function inferPickerType(dateString: string, picker?): 'year' | 'month' | 'quarter' | 'date' {
if (/^\d{4}$/.test(dateString)) {
return 'year';
} else if (/^\d{4}-\d{2}$/.test(dateString)) {
@ -281,6 +281,6 @@ export function inferPickerType(dateString: string, picker): 'year' | 'month' |
} else if (/^\d{4}-\d{2}-\d{2}$/.test(dateString)) {
return 'date';
} else {
return picker;
return picker || 'date';
}
}