diff --git a/resources/js/components/ui/DateRangePicker/DateRangePicker.vue b/resources/js/components/ui/DateRangePicker/DateRangePicker.vue
index 69e7a6370b..644bb30361 100644
--- a/resources/js/components/ui/DateRangePicker/DateRangePicker.vue
+++ b/resources/js/components/ui/DateRangePicker/DateRangePicker.vue
@@ -22,7 +22,6 @@ import {
import Card from '../Card/Card.vue';
import Button from '../Button/Button.vue';
import Calendar from '../Calendar/Calendar.vue';
-import Icon from '../Icon/Icon.vue';
import { parseAbsoluteToLocal } from '@internationalized/date';
const emit = defineEmits(['update:modelValue']);
@@ -32,7 +31,7 @@ const props = defineProps({
badge: { type: String, default: null },
required: { type: Boolean, default: false },
/** The controlled date range value with `start` and `end` properties.
Each should be an ISO 8601 date and time string with a UTC offset (eg. `2021-11-07T07:45:00Z` or `2021-11-07T07:45:00-07:00`) */
- modelValue: { type: [Object, String], default: null },
+ modelValue: { type: [Object, String], required: true, default: () => ({start: null, end: null}) },
/** The minimum selectable date.
Should be an ISO 8601 date and time string with a UTC offset (eg. `2021-11-07T07:45:00Z` or `2021-11-07T07:45:00-07:00`) */
min: { type: [String, Object], default: null },
/** The maximum selectable date.
Should be an ISO 8601 date and time string with a UTC offset (eg. `2021-11-07T07:45:00Z` or `2021-11-07T07:45:00-07:00`) */
@@ -76,6 +75,12 @@ const placeholder = parseAbsoluteToLocal(new Date().toISOString());
const calendarEvents = computed(() => ({
'update:model-value': (event) => {
if (props.granularity === 'day') {
+
+ // Avoid fatal error `Cannot set properties of undefined (setting 'hour')`
+ if (event.end == null) {
+ return
+ }
+
event.start.hour = 0;
event.start.minute = 0;
event.start.second = 0;
@@ -90,6 +95,12 @@ const calendarEvents = computed(() => ({
emit('update:modelValue', event)
},
}));
+
+const hasDates = computed(() => {
+ return calendarBindings.value.modelValue != null
+ && calendarBindings.value.modelValue.end != null
+ && calendarBindings.value.modelValue?.start != null
+})
@@ -155,7 +166,7 @@ const calendarEvents = computed(() => ({