Summary
canTermEnrollmentChange in apps/antalmanac/src/lib/termHelpers.ts (line ~74) closes the enrollment window at the start of Friday (00:00:00 local) instead of at the end.
Repro
term.instructionStart is built by parseLocalDate to local midnight. addWeeks and date-fns setDay both preserve time-of-day from the input, so the right-hand side of the comparison resolves to Friday 00:00:00. Anyone checking after Friday 12:00:01 AM sees enrollment as closed, when UCI's drop policy treats Friday as a valid drop day.
Root cause
return new Date() <= setDay(addWeeks(term.instructionStart, weeksUntilDropDeadline), 5);
Introduced in #1784. Caught by cubic on #1816 and tracked separately so the refactor PR stays focused.
Suggested fix
const dropDeadline = setDay(addWeeks(term.instructionStart, weeksUntilDropDeadline), 5);
dropDeadline.setHours(23, 59, 59, 999);
return new Date() <= dropDeadline;
But — before committing, confirm against UCI's actual deadline:
The policy might say 5 PM Friday (registrar business close), not midnight. If so, use setHours(17, 0, 0, 0) instead.
Acceptance criteria
Summary
canTermEnrollmentChangeinapps/antalmanac/src/lib/termHelpers.ts(line ~74) closes the enrollment window at the start of Friday (00:00:00 local) instead of at the end.Repro
term.instructionStartis built byparseLocalDateto local midnight.addWeeksand date-fnssetDayboth preserve time-of-day from the input, so the right-hand side of the comparison resolves to Friday 00:00:00. Anyone checking after Friday 12:00:01 AM sees enrollment as closed, when UCI's drop policy treats Friday as a valid drop day.Root cause
Introduced in #1784. Caught by cubic on #1816 and tracked separately so the refactor PR stays focused.
Suggested fix
But — before committing, confirm against UCI's actual deadline:
The policy might say 5 PM Friday (registrar business close), not midnight. If so, use
setHours(17, 0, 0, 0)instead.Acceptance criteria
setHours/endOfDaycallvi.useFakeTimers()(Thursday 11:59 PM → true; configured time on Friday → true; later Friday → false; Saturday → false)fix: