diff --git a/src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue b/src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue index 3ea14b26a..c25ff254c 100644 --- a/src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue +++ b/src/coalesce-vue-vuetify3/src/components/input/c-datetime-picker.vue @@ -75,7 +75,16 @@ :min="min ? startOfDay(min) : undefined" :max="max ? endOfDay(max) : undefined" v-bind="datePickerProps" + :show-adjacent-months="true" > + @@ -160,6 +169,7 @@ import { startOfDay, endOfDay, startOfHour, + set, } from "date-fns"; import { format, toZonedTime, fromZonedTime } from "date-fns-tz"; import { @@ -584,6 +594,34 @@ function emitInput(value: Date | null) { } } +function setToday() { + const now = new Date(); + const today = startOfDay(now); + + // Preserve existing time if it's set + if (internalValueZoned.value) { + const existingDate = internalValueZoned.value; + + const newDate = set(today, { + hours: existingDate.getHours(), + minutes: existingDate.getMinutes(), + seconds: existingDate.getSeconds(), + milliseconds: existingDate.getMilliseconds(), + }); + + if (internalTimeZone.value) { + // Adjust for the specified time zone + modelValue.value = fromZonedTime(newDate, internalTimeZone.value); + } else { + // No time zone specified, use the new date as is + modelValue.value = newDate; + } + } else { + // No existing date/time, just set to start of today + modelValue.value = today; + } +} + function close() { menu.value = false; } diff --git a/src/coalesce-vue-vuetify3/src/components/input/c-time-picker.vue b/src/coalesce-vue-vuetify3/src/components/input/c-time-picker.vue index 54ae683cc..fda192c2c 100644 --- a/src/coalesce-vue-vuetify3/src/components/input/c-time-picker.vue +++ b/src/coalesce-vue-vuetify3/src/components/input/c-time-picker.vue @@ -73,7 +73,7 @@ } .c-time-picker__column { - max-height: 328px; + max-height: 365px; overflow-y: auto; overflow-x: hidden; padding: 8px 9px;