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 * as mongoose from 'mongoose'
|
||||||
import { v4 as uuidv4 } from 'uuid'
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { startOfDay } from 'date-fns'
|
|
||||||
import { dateFormatBackend, getDays } from '../helpers/date'
|
import { dateFormatBackend, getDays } from '../helpers/date'
|
||||||
import { Bill } from './bill'
|
import { Bill } from './bill'
|
||||||
import { Booker } from './booker'
|
import { Booker } from './booker'
|
||||||
@@ -10,8 +9,8 @@ export interface Booking {
|
|||||||
uuid: string
|
uuid: string
|
||||||
booker: Booker
|
booker: Booker
|
||||||
bill: Bill
|
bill: Bill
|
||||||
startDate: Date
|
startDate: string
|
||||||
endDate: Date
|
endDate: string
|
||||||
status: BOOKING_STATUS
|
status: BOOKING_STATUS
|
||||||
purpose?: string
|
purpose?: string
|
||||||
org?: string
|
org?: string
|
||||||
@@ -94,7 +93,8 @@ BookingSchema.static('findBookedDays', async function (): Promise<string[]> {
|
|||||||
.find(
|
.find(
|
||||||
{
|
{
|
||||||
status: { $in: [BOOKING_STATUS.REQUESTED, BOOKING_STATUS.CONFIRMED] },
|
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'
|
'days'
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user