fix: datatime format support preview (#3572)

This commit is contained in:
katherinehhh 2024-02-26 17:00:18 +08:00 committed by GitHub
parent 88b281277c
commit 0e728ca5a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View File

@ -65,15 +65,12 @@ const InternalExpiresRadio = (props) => {
{props.options.map((v) => {
if (v.value === 'custom') {
return (
<Radio value={v.value}>
<Radio value={v.value} key={v.value}>
<Input
style={{ width: '150px' }}
defaultValue={targetValue}
onChange={(e) => {
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) => {
</Radio>
);
}
return <Radio value={v.value}>{v.label}</Radio>;
return (
<Radio value={v.value} key={v.value}>
{v.label}
</Radio>
);
})}
</Space>
</Radio.Group>

View File

@ -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' }),