Files
TREK/client/src/components/Planner/stayDayTimes.ts
T
Maurice 8fd46c4c18 feat: quality of life sweep from the feature discussions
Small requests from the discussions, each built end to end: planner and
map (cycling mode, date first headings, clear a day, stay times per day,
off-route stops, map lock, compact unplanned markers, pending stays,
cable car, transit quick picks), places (location filter, category from
OSM, open in maps, geo: link, image from an attachment, enrichment on
file import, places near a pin, place name language, Amap first in
China), lists and costs (packed counter, inherited sharing, Markdown
to-dos, payment notes, bookings CSV, my plan PDF), sharing (unplanned
places, travel only, without photos), journey (photo zoom, drafts,
photo order, trip suggestion, day jump), atlas (region counter, region
bucket list, places per country), vacay half company holidays, studio
copy and paste plus the book's own layouts, and RESTORE_FROM_BACKUP for
a first start restore.
2026-09-30 23:00:12 +02:00

26 lines
882 B
TypeScript

interface StayRange {
start_day_id: number | null
end_day_id: number | null
check_in?: string | null
check_out?: string | null
}
export interface StayDayTimes {
/** The check-in time belongs on this day: it is the arrival day and a time is set. */
checkIn: boolean
/** The check-out time belongs on this day: it is the departure day and a time is set. */
checkOut: boolean
}
/**
* Which of a stay's two times matter on a given day (#2393). The arrival day shows the
* check-in, the departure day the check-out, a one-night stop on a single day both; a
* night in the middle of the stay shows neither, since nothing happens at the desk then.
*/
export function stayDayTimes(stay: StayRange, dayId: number): StayDayTimes {
return {
checkIn: stay.start_day_id === dayId && !!stay.check_in,
checkOut: stay.end_day_id === dayId && !!stay.check_out,
}
}