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

@@ -7,6 +7,7 @@ interface Props {
isMinGranularityPicker?: boolean
minGranularity?: number
isOpen?: boolean
showCurrentDateOption?: boolean
}
const props = withDefaults(defineProps<Props>(), {
@@ -16,7 +17,7 @@ const props = withDefaults(defineProps<Props>(), {
minGranularity: 30,
isOpen: false,
})
const emit = defineEmits(['update:selectedDate'])
const emit = defineEmits(['update:selectedDate', ''])
const pageDate = ref<dayjs.Dayjs>(dayjs())
@@ -93,10 +94,20 @@ onMounted(() => {
</div>
</div>
<div v-else></div>
<div class="px-2 py-1 box-border flex items-center justify-center">
<div class="px-2 py-1 box-border flex items-center justify-center gap-2">
<NcButton :tabindex="-1" class="!h-7" size="small" type="secondary" @click="handleSelectTime(dayjs())">
<span class="text-small"> {{ $t('general.now') }} </span>
</NcButton>
<NcButton
v-if="showCurrentDateOption"
class="nc-date-picker-now-btn !h-7"
size="small"
type="secondary"
@click="emit('currentDate')"
>
<span class="text-small"> {{ $t('labels.currentDate') }} </span>
</NcButton>
</div>
</div>
</template>