diff --git a/packages/nc-gui/components/cell/DateTimePicker.vue b/packages/nc-gui/components/cell/DateTimePicker.vue index 97d728a9b5..e430b6c854 100644 --- a/packages/nc-gui/components/cell/DateTimePicker.vue +++ b/packages/nc-gui/components/cell/DateTimePicker.vue @@ -24,7 +24,7 @@ const { modelValue, isPk } = defineProps() const emit = defineEmits(['update:modelValue']) -const { isMysql } = useProject() +const { isMysql, isSqlite } = useProject() const { showNull } = useGlobal() @@ -55,6 +55,14 @@ let localState = $computed({ return undefined } + if (isSqlite(column.value.base_id)) { + return /^\d+$/.test(modelValue) + ? dayjs(+modelValue) + .utc(true) + .local() + : dayjs(modelValue).utc(true).local() + } + return /^\d+$/.test(modelValue) ? dayjs(+modelValue) : dayjs(modelValue) }, set(val?: dayjs.Dayjs) { @@ -66,6 +74,8 @@ let localState = $computed({ if (val.isValid()) { if (isMysql(column.value.base_id)) { emit('update:modelValue', val?.format('YYYY-MM-DD HH:mm:ss')) + } else if (isSqlite(column.value.base_id)) { + emit('update:modelValue', dayjs(val).utc().format('YYYY-MM-DD HH:mm:ss')) } else { emit('update:modelValue', dayjs(val).utc().format('YYYY-MM-DD HH:mm:ssZ')) }