mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
use strings for startDate endDate
all the way to the FE
This commit is contained in:
@@ -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<string[]> {
|
||||
.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'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user