Browse Source

feat(nc-gui): apply new logic on xcdb base only

pull/5601/head
Wing-Kam Wong 2 years ago
parent
commit
e348c44125
  1. 19
      packages/nc-gui/components/cell/DateTimePicker.vue

19
packages/nc-gui/components/cell/DateTimePicker.vue

@ -24,7 +24,7 @@ const { modelValue, isPk } = defineProps<Props>()
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
const { isMysql, isSqlite } = useProject() const { isMysql, isSqlite, isXcdbBase } = useProject()
const { showNull } = useGlobal() const { showNull } = useGlobal()
@ -55,7 +55,7 @@ let localState = $computed({
return undefined return undefined
} }
if (isSqlite(column.value.base_id)) { if (isXcdbBase(column.value.base_id) && isSqlite(column.value.base_id)) {
return /^\d+$/.test(modelValue) return /^\d+$/.test(modelValue)
? dayjs(+modelValue) ? dayjs(+modelValue)
.utc(true) .utc(true)
@ -72,12 +72,17 @@ let localState = $computed({
} }
if (val.isValid()) { if (val.isValid()) {
if (isMysql(column.value.base_id)) { if (isXcdbBase(column.value.base_id)) {
emit('update:modelValue', val?.format('YYYY-MM-DD HH:mm:ss')) if (isMysql(column.value.base_id)) {
} else if (isSqlite(column.value.base_id)) { emit('update:modelValue', val?.format('YYYY-MM-DD HH:mm:ss'))
emit('update:modelValue', dayjs(val).utc().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'))
}
} else { } else {
emit('update:modelValue', dayjs(val).utc().format('YYYY-MM-DD HH:mm:ssZ')) // TODO(timezone): keep ext db as it is
emit('update:modelValue', val?.format(isMysql(column.value.base_id) ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ'))
} }
} }
}, },

Loading…
Cancel
Save