Skip to content

Commit 858169a

Browse files
committed
fix: datePicker support empty, close #6510
1 parent 80fbabc commit 858169a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

components/vc-picker/RangePicker.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,11 @@ function RangerPicker<DateType>() {
315315

316316
// Fill disabled unit
317317
for (let i = 0; i < 2; i += 1) {
318-
if (mergedDisabled.value[i] && !getValue(postValues, i) && !getValue(props.allowEmpty, i)) {
318+
if (
319+
mergedDisabled.value[i] &&
320+
!getValue(postValues, i) &&
321+
!getValue(props.allowEmpty, i)
322+
) {
319323
postValues = updateValues(postValues, props.generateConfig.getNow(), i);
320324
}
321325
}

components/vc-picker/generate/dayjs.ts

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ function findTargetStr(val: string, index: number, segmentation: string) {
123123
}
124124

125125
const toDateWithValueFormat = (val: string | Dayjs, valueFormat: string) => {
126+
if (!val) return null;
126127
if (dayjs.isDayjs(val)) {
127128
return val;
128129
}

0 commit comments

Comments
 (0)