diff --git a/db/booking.ts b/db/booking.ts index 21793e6..8db62c9 100644 --- a/db/booking.ts +++ b/db/booking.ts @@ -1,6 +1,5 @@ import * as mongoose from 'mongoose' import { v4 as uuidv4 } from 'uuid' -import { startOfDay } from 'date-fns' import { dateFormatBackend, getDays } from '../helpers/date' import { Bill } from './bill' import { Booker } from './booker' @@ -10,8 +9,8 @@ export interface Booking { uuid: string booker: Booker bill: Bill - startDate: Date - endDate: Date + startDate: string + endDate: string status: BOOKING_STATUS purpose?: string org?: string @@ -94,7 +93,8 @@ BookingSchema.static('findBookedDays', async function (): Promise { .find( { status: { $in: [BOOKING_STATUS.REQUESTED, BOOKING_STATUS.CONFIRMED] }, - endDate: { $gt: startOfDay(new Date()) }, + // dateFormatBackend uses YYYY-MM-DD, which is startOfDay anyway + endDate: { $gt: dateFormatBackend(new Date()) }, }, 'days' )