Skip to content

canTermEnrollmentChange closes enrollment at Friday 00:00 instead of end of day #1818

@sicn4rf

Description

@sicn4rf

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

  • Verify the correct deadline time from UCI's policy
  • Apply the matching setHours / endOfDay call
  • Add a unit test pinning down the boundary with vi.useFakeTimers() (Thursday 11:59 PM → true; configured time on Friday → true; later Friday → false; Saturday → false)
  • PR title prefix: fix:

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first taskGood task for someone new to the projectmediumMedium priority issue

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog 🥱

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions