From 0e728ca5a5c107e9e3e594d8cfb4274ebf490115 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Mon, 26 Feb 2024 17:00:18 +0800 Subject: [PATCH] fix: datatime format support preview (#3572) --- .../src/schema-settings/DateFormat/ExpiresRadio.tsx | 13 +++++++------ .../client/src/schema-settings/SchemaSettings.tsx | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/core/client/src/schema-settings/DateFormat/ExpiresRadio.tsx b/packages/core/client/src/schema-settings/DateFormat/ExpiresRadio.tsx index 14a13169a..cfd367620 100644 --- a/packages/core/client/src/schema-settings/DateFormat/ExpiresRadio.tsx +++ b/packages/core/client/src/schema-settings/DateFormat/ExpiresRadio.tsx @@ -65,15 +65,12 @@ const InternalExpiresRadio = (props) => { {props.options.map((v) => { if (v.value === 'custom') { return ( - + { - if ( - e.target.value && - moment(timeFormat ? date.format() : date.toLocaleString(), e.target.value).isValid() - ) { + if (e.target.value) { setCustomFormatPreview(date.format(e.target.value)); } else { setCustomFormatPreview(null); @@ -87,7 +84,11 @@ const InternalExpiresRadio = (props) => { ); } - return {v.label}; + return ( + + {v.label} + + ); })} diff --git a/packages/core/client/src/schema-settings/SchemaSettings.tsx b/packages/core/client/src/schema-settings/SchemaSettings.tsx index 236dad184..9d90feac3 100644 --- a/packages/core/client/src/schema-settings/SchemaSettings.tsx +++ b/packages/core/client/src/schema-settings/SchemaSettings.tsx @@ -1463,13 +1463,13 @@ export const SchemaSettingsDateFormat = function DateFormatConfig(props: { field } `, defaultValue: 'dddd', - formats: ['MMMMM Do YYYY', 'YYYY-MM-DD', 'MM/DD/YY', 'YYYY/MM/DD', 'DD/MM/YYYY'], + formats: ['MMMM Do YYYY', 'YYYY-MM-DD', 'MM/DD/YY', 'YYYY/MM/DD', 'DD/MM/YYYY'], }, default: dateFormatDefaultValue, enum: [ { - label: DateFormatCom({ format: 'MMMMM Do YYYY' }), - value: 'MMMMM Do YYYY', + label: DateFormatCom({ format: 'MMMM Do YYYY' }), + value: 'MMMM Do YYYY', }, { label: DateFormatCom({ format: 'YYYY-MM-DD' }),