diff --git a/packages/nc-gui/components/cell/DatePicker.vue b/packages/nc-gui/components/cell/DatePicker.vue index cd5b74e626..85689d6bfb 100644 --- a/packages/nc-gui/components/cell/DatePicker.vue +++ b/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')) }