Browse Source

fix(nc-gui): reset day to 1st for month picker

pull/6870/head
աɨռɢӄաօռɢ 1 year ago
parent
commit
66bf8b8b85
  1. 7
      packages/nc-gui/components/cell/DatePicker.vue

7
packages/nc-gui/components/cell/DatePicker.vue

@ -62,7 +62,7 @@ const localState = computed({
return undefined
}
return /^\d+$/.test(modelValue) ? dayjs(+modelValue) : dayjs(modelValue)
return dayjs(/^\d+$/.test(modelValue) ? +modelValue : modelValue, dateFormat.value)
},
set(val?: dayjs.Dayjs) {
if (!val) {
@ -70,6 +70,11 @@ const localState = computed({
return
}
if (picker.value === 'month') {
// reset day to 1st
val = dayjs(val).date(1)
}
if (val.isValid()) {
emit('update:modelValue', val?.format('YYYY-MM-DD'))
}

Loading…
Cancel
Save