· Getting better at this jam

Trying to figure out how to compare dates

Resolved

Hi. I'm trying to figure out an issue that's been bothering me for about a week now. I have a colleciton of documents called reservations that contain an aircraft_id, pilot_id, reservationStart, and reservationEnd times. I'm trying to build an action that when in the app a pilot books a plane for a specific time. When they submit the reservation I want the system to query the reservations collection based on the aircraft_id. I want to then compare what the pilot want's to book for versus what has already been booked in another document to make sure that the plane is not already scheduled within that window. If it is then they cannot book it otherwise let them reserve it. I'm guessing that the way to accomplish this is through a custom function but I'm having trouble working through the database call in the actual function. Does anyone have any tips or suggestions on what i might be doing wrong or what i could change?

10 replies