fix(components): [date-picker] sync input value with time-picker (#20713)

* fix(components): [date-picker] sync input value with time-picker

* test: set test case
This commit is contained in:
Noblet Ouways
2025-12-11 22:56:27 +01:00
committed by GitHub
parent 0acd025a22
commit 39adcf4882
2 changed files with 23 additions and 2 deletions

View File

@@ -627,6 +627,27 @@ describe('DatePickerPanel', () => {
expect((right.timeInput as HTMLInputElement).value).toBe('AM 01:01:01')
})
it('should get the display date in disabled-hours callback', async () => {
const modelValue = ['2025-05-12 00:00:00', '2025-05-24 00:00:00']
const disabledHours = (_role: string, date: dayjs.Dayjs) => {
expect(dayjs(date).isSame(modelValue[1])).toBe(true)
}
const wrapper = mount(() => (
<DatePickerPanel
model-value={modelValue}
type="datetimerange"
//@ts-expect-error
disabledHours={disabledHours}
/>
))
const timeInput = wrapper.findAll(
'.el-date-range-picker__editors-wrap input'
)[3]
await timeInput.trigger('blur')
await timeInput.trigger('focus')
})
it('input date', async () => {
const value = ref<string[]>([])
const wrapper = mount(() => (

View File

@@ -59,7 +59,7 @@
:visible="minTimePickerVisible"
:format="timeFormat"
datetime-role="start"
:parsed-value="leftDate"
:parsed-value="minDate || leftDate"
@pick="handleMinTimePick"
/>
</span>
@@ -101,7 +101,7 @@
datetime-role="end"
:visible="maxTimePickerVisible"
:format="timeFormat"
:parsed-value="rightDate"
:parsed-value="maxDate || rightDate"
@pick="handleMaxTimePick"
/>
</span>