fix: Add internationalization support for date input formatting Fixes #23266 (#23678)

This commit is contained in:
baonudesifeizhai 2025-08-09 23:05:55 -04:00 • committed by GitHub
commit 0be3b4e7a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 86 additions and 4 deletions

View file

@ -78,7 +78,6 @@ const DatePicker = ({
setCurrentDate(prev => getDateWithTimezone({ date: prev, timezone }))
setSelectedDate(prev => prev ? getDateWithTimezone({ date: prev, timezone }) : undefined)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [timezone])
const handleClickTrigger = (e: React.MouseEvent) => {
@ -192,7 +191,7 @@ const DatePicker = ({
setView(ViewType.date)
}
const timeFormat = needTimePicker ? 'MMMM D, YYYY hh:mm A' : 'MMMM D, YYYY'
const timeFormat = needTimePicker ? t('time.dateFormats.displayWithTime') : t('time.dateFormats.display')
const displayValue = value?.format(timeFormat) || ''
const displayTime = selectedDate?.format('hh:mm A') || '--:-- --'
const placeholderDate = isOpen && selectedDate ? selectedDate.format(timeFormat) : (placeholder || t('time.defaultPlaceholder'))