feat: default date/datetime value as current date

This commit is contained in:
Pranav C
2024-08-19 07:55:03 +00:00
parent fbf4d937d7
commit f4e68271e2
16 changed files with 153 additions and 26 deletions

View File

@@ -10,7 +10,7 @@ interface Props {
const { modelValue, isPk, isUpdatedFromCopyNPaste } = defineProps<Props>()
const emit = defineEmits(['update:modelValue'])
const emit = defineEmits(['update:modelValue', 'currentDate'])
const timeFormatsObj = {
[timeFormats[0]]: 'hh:mm A',
@@ -425,6 +425,11 @@ const cellValue = computed(
localState.value?.format(parseProp(column.value.meta).is12hrFormat ? timeFormatsObj[timeFormat.value] : timeFormat.value) ??
'',
)
const currentDate = ($event) => {
open.value = false
emit('currentDate', $event)
}
</script>
<template>
@@ -510,7 +515,9 @@ const cellValue = computed(
:is-open="isOpen"
type="date"
size="medium"
:show-current-date-option="isEditColumn"
@update:selected-date="handleSelectDate"
@current-date="currentDate"
/>
<template v-else>
@@ -520,7 +527,9 @@ const cellValue = computed(
is-min-granularity-picker
:is12hr-format="!!parseProp(column.meta).is12hrFormat"
:is-open="isOpen"
:show-current-date-option="isEditColumn"
@update:selected-date="handleSelectTime"
@current-date="currentDate"
/>
</template>
</div>