mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix datetime string handler not matching default value for format option (#19168)
* Default format to `long` to match display value Fixes #19152 * Add changeset
This commit is contained in:
6
.changeset/selfish-berries-whisper.md
Normal file
6
.changeset/selfish-berries-whisper.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@directus/app': patch
|
||||
---
|
||||
|
||||
Fixed an issue that would prevent the "Download Page as CSV" option to function when using a datetime display with
|
||||
missing options
|
||||
@@ -35,16 +35,16 @@ export default defineDisplay({
|
||||
} else {
|
||||
let format;
|
||||
|
||||
if (options?.format === 'long') {
|
||||
if (options?.format === undefined || options.format === 'long') {
|
||||
format = `${i18n.global.t('date-fns_date')} ${i18n.global.t('date-fns_time')}`;
|
||||
if (field?.type === 'date') format = String(i18n.global.t('date-fns_date'));
|
||||
if (field?.type === 'time') format = String(i18n.global.t('date-fns_time'));
|
||||
} else if (options?.format === 'short') {
|
||||
} else if (options.format === 'short') {
|
||||
format = `${i18n.global.t('date-fns_date_short')} ${i18n.global.t('date-fns_time_short')}`;
|
||||
if (field?.type === 'date') format = String(i18n.global.t('date-fns_date_short'));
|
||||
if (field?.type === 'time') format = String(i18n.global.t('date-fns_time_short'));
|
||||
} else {
|
||||
format = options?.format;
|
||||
format = options.format;
|
||||
}
|
||||
|
||||
return localizedFormat(value, format);
|
||||
|
||||
Reference in New Issue
Block a user