fix issue

This commit is contained in:
Marshal
2026-07-16 00:33:31 +00:00
parent 234a74e812
commit 41fe04652f
51 changed files with 1895 additions and 206 deletions

View File

@@ -2,7 +2,7 @@ export interface SchedulingPriorityBooking {
isGovernment?: boolean;
priorityScore?: number | null;
// One-time bookings always carry a date; general contracts (never scheduled)
// may be null — treated as epoch 0 so they sort last.
// may be null — treated as the far future (MAX_SAFE_INTEGER) so they sort last.
scheduledDate?: Date | string | null;
}
@@ -17,7 +17,11 @@ export function compareSchedulingPriority(
const priorityDiff = (b.priorityScore ?? 0) - (a.priorityScore ?? 0);
if (priorityDiff !== 0) return priorityDiff;
const aTime = a.scheduledDate ? new Date(a.scheduledDate).getTime() : 0;
const bTime = b.scheduledDate ? new Date(b.scheduledDate).getTime() : 0;
const aTime = a.scheduledDate
? new Date(a.scheduledDate).getTime()
: Number.MAX_SAFE_INTEGER;
const bTime = b.scheduledDate
? new Date(b.scheduledDate).getTime()
: Number.MAX_SAFE_INTEGER;
return aTime - bTime;
}