Skip to content

Commit

Permalink
Prevent the date range from breaking when an invalid time is entered
Browse files Browse the repository at this point in the history
  • Loading branch information
pleek91 committed Dec 12, 2023
1 parent 7ce9389 commit c85c433
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/components/DateTimeInputGroup/PDateTimeInputGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
</template>

<PContent secondary>
<PNativeDateInput v-model="date" disable-picker />
<PNativeDateInput v-model="startDate" disable-picker />

<template v-if="showTime">
<PNativeTimeInput v-model="date" disable-picker />
<PNativeTimeInput v-model="startTime" disable-picker />
</template>
</PContent>
</PLabel>
Expand All @@ -38,7 +38,7 @@
(event: 'update:modelValue', value: Date | null): void,
}>()
const date = computed({
const startDate = computed({
get() {
return props.modelValue ?? null
},
Expand All @@ -47,6 +47,18 @@
},
})
const startTime = computed({
get() {
return props.modelValue ?? null
},
set(value) {
if (!value) {
return
}
emit('update:modelValue', value)
},
})
const nowOrTodayLabel = computed(() => props.showTime ? 'Now' : 'Today')
function setToTodayOrNow(): void {
Expand Down

0 comments on commit c85c433

Please sign in to comment.