/** * The one invariant that makes a shiftSchedule period mean something: every Shift hanging off a ShiftSchedule * falls inside that ShiftSchedule's dates. Overlapping shiftSchedules are allowed (membership is the explicit * shiftScheduleId FK), so this is what keeps a period honest rather than a uniqueness rule. */ export function isWithinPeriod(date: Date, startDate: Date, endDate: Date): boolean { const at = date.getTime(); return at >= startDate.getTime() && at <= endDate.getTime(); }