diff --git a/src/components/Booking/BookingEdit.vue b/src/components/Booking/BookingEdit.vue index 1d8ce34..2c0e22c 100644 --- a/src/components/Booking/BookingEdit.vue +++ b/src/components/Booking/BookingEdit.vue @@ -77,20 +77,24 @@ :placeholder="selectedBooking._couponUsed.id" > - - - + + + @@ -527,42 +531,54 @@ export default { }, dateFrom: { get() { - if (!this.selectedBooking.timeBegin) return undefined; + if (!this.selectedBooking.timeBegin) { + return this.formatDate(new Date()); + } return this.formatDate(new Date(this.selectedBooking.timeBegin)); }, set(val) { - this.selectedBooking.timeBegin = new Date(val + " " + this.timeFrom); + this.selectedBooking.timeBegin = new Date( + val + " " + this.timeFrom + ).getTime(); }, }, dateTo: { get() { - if (!this.selectedBooking.timeEnd) return undefined; + if (!this.selectedBooking.timeEnd) { + return this.formatDate(new Date()); + } return this.formatDate(new Date(this.selectedBooking.timeEnd)); }, set(val) { - this.selectedBooking.timeEnd = new Date(val + " " + this.timeTo); + this.selectedBooking.timeEnd = new Date( + val + " " + this.timeTo + ).getTime(); }, }, timeFrom: { get() { - if (!this.selectedBooking.timeBegin) return undefined; + if (!this.selectedBooking.timeBegin) { + return this.formatTime(new Date()); + } return this.formatTime(new Date(this.selectedBooking.timeBegin)); }, set(val) { - this.selectedBooking.timeBegin = this.formatDateTime( - new Date(this.dateFrom + " " + val) - ); + this.selectedBooking.timeBegin = new Date( + this.dateFrom + " " + val + ).getTime(); }, }, timeTo: { get() { - if (!this.selectedBooking.timeEnd) return undefined; + if (!this.selectedBooking.timeEnd) { + return this.formatTime(new Date()) + } return this.formatTime(new Date(this.selectedBooking.timeEnd)); }, set(val) { - this.selectedBooking.timeEnd = this.formatDateTime( - new Date(this.dateTo + " " + val) - ); + this.selectedBooking.timeEnd = new Date( + this.dateTo + " " + val + ).getTime(); }, }, bookableItems: { @@ -736,7 +752,7 @@ export default { this.selectedBooking.timeEnd = null; }, }, - created() { + mounted() { if (this.selectedBooking._id) { this.getEvents(); } diff --git a/src/views/Management/Bookings.vue b/src/views/Management/Bookings.vue index 4054366..462de3e 100644 --- a/src/views/Management/Bookings.vue +++ b/src/views/Management/Bookings.vue @@ -364,8 +364,8 @@ export default { this.selectedBooking = { tenant: this.tenant, assignedUserId: null, - timeBegin: 1681383600000, - timeEnd: 1681387200000, + timeBegin: Date.now(), + timeEnd: Date.now(), bookableItems: [], couponCode: null, name: null,