fix: datepicker client test (#6064)

This commit is contained in:
Katherine 2025-01-15 11:10:21 +08:00 committed by GitHub
parent 86b354d7de
commit 8ba098faeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 13 deletions

View File

@ -54,9 +54,9 @@ export const DatePicker: ComposedDatePicker = (props: any) => {
const value = Array.isArray(props.value) ? props.value[0] : props.value;
const newProps = {
utc,
inputReadOnly: true,
...props,
showTime: props.showTime ? { defaultValue: dayjs('00:00:00', 'HH:mm:ss') } : false,
inputReadOnly: true,
};
return <InternalDatePicker {...newProps} value={value} />;
};
@ -99,11 +99,11 @@ DatePicker.RangePicker = function RangePicker(props: any) {
const newProps: any = {
utc,
presets,
inputReadOnly: true,
...props,
format: getDateTimeFormat(targetPicker, targetDateFormat, showTime, timeFormat),
picker: targetPicker,
showTime: showTime ? { defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')] } : false,
inputReadOnly: true,
};
const [stateProps, setStateProps] = useState(newProps);
if (isFilterAction) {
@ -171,12 +171,12 @@ DatePicker.FilterWithPicker = function FilterWithPicker(props: any) {
const targetDateFormat = getPickerFormat(targetPicker) || format;
const newProps = {
utc,
inputReadOnly: true,
...props,
underFilter: true,
showTime: showTime ? { defaultValue: dayjs('00:00:00', 'HH:mm:ss') } : false,
format: getDateTimeFormat(targetPicker, targetDateFormat, showTime, timeFormat),
picker: targetPicker,
inputReadOnly: true,
onChange: (val) => {
props.onChange(undefined);
setTimeout(() => {

View File

@ -1,5 +1,3 @@
/**
* title: DatePicker
*/
@ -18,6 +16,7 @@ const schema = {
'x-component-props': {
dateFormat: 'YYYY/MM/DD',
showTime: true,
inputReadOnly: false,
},
'x-reactions': {
target: '*(read1,read2)',

View File

@ -1,5 +1,3 @@
/**
* title: DatePicker (GMT)
*/
@ -19,6 +17,7 @@ const schema = {
dateFormat: 'YYYY/MM/DD',
showTime: true,
gmt: true,
inputReadOnly: false,
},
default: '2022-06-04T15:00:00.000Z',
'x-reactions': {

View File

@ -1,5 +1,3 @@
/**
* title: DatePicker
*/
@ -19,6 +17,7 @@ const schema = {
dateFormat: 'YYYY/MM/DD',
showTime: false,
utc: false,
inputReadOnly: false,
},
'x-reactions': {
target: '*(read1,read2)',

View File

@ -1,5 +1,3 @@
/**
* title: DatePicker
*/
@ -20,6 +18,7 @@ const schema = {
showTime: false,
gmt: true,
utc: true,
inputReadOnly: false,
},
'x-reactions': {
target: '*(read1,read2)',

View File

@ -1,5 +1,3 @@
/**
* title: DatePicker
*/
@ -20,6 +18,7 @@ const schema = {
showTime: false,
gmt: false,
utc: true,
inputReadOnly: false,
},
'x-reactions': {
target: '*(read1,read2)',