Skip to content

fix(SDK-1274): disable invalid payment dates in the off-cycle picker - #2650

Merged
krisxcrash merged 2 commits into
mainfrom
kw/fix/sdk-1274-payment-date-missing-minimum-date
Aug 27, 2026
Merged

fix(SDK-1274): disable invalid payment dates in the off-cycle picker#2650
krisxcrash merged 2 commits into
mainfrom
kw/fix/sdk-1274-payment-date-missing-minimum-date

Conversation

@krisxcrash

@krisxcrash krisxcrash commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Fixes SDK-1274 (Medium, Pay v2 / RRoP Test Fest).

Root cause

OffCyclePayPeriodDateFormPresentation rendered the payment-date field as a bare <DatePickerField name="checkDate" ... /> with no minDate, so the earliest-valid-check-date rule existed only as a submit-time validation error. You could pick a past date, submit, and only then be told it was invalid. Legacy gws-flows disables invalid dates in the picker.

The bound was already being computedOffCycleCreation gets { minCheckDate, today } from useOffCyclePayPeriodDateValidation and feeds it to the zod resolver as isCheckOnly ? today : minCheckDate. It just never reached the field. minDate is already on DatePickerProps and passes straight through DatePickerFieldProps, so the plumbing existed too.

(Confirmed "Payment date" is the checkDate field — Payroll.OffCyclePayPeriodDateForm.jsoncheckDateLabel.)

Fix

Thread both dates container → presentation, matching the container/presentation split used elsewhere here, and apply the same expression the resolver uses:

minDate={isCheckOnly ? minCheckOnlyDate : minCheckDate}

Reusing the resolver's own expression is what makes the second AC hold — picker and validation cannot drift, so a date the picker allows can never fail validation on submit. Checking "check-only payroll" widens the bound back to today, live.

Testing

Two new cases in OffCycleCreation.test.tsx, following the calendar-aria-disabled pattern the DatePicker UI tests already use. System time is pinned to Wed Sep 2 2026 (so + 2 mocked business days = Fri Sep 4) because the bound derives from today:

  • the payment-date calendar disables Sep 3 and allows Sep 4
  • toggling check-only relaxes the bound: Sep 2 becomes selectable, Sep 1 stays disabled

I verified both tests fail when the minDate line is removed, so they guard the fix rather than merely passing.

npx vitest run src/components/Payroll — 627 pass. npm run tsc, eslint, prettier — clean. Stories updated with fixed date bounds so they stay deterministic.

Same class of gap, deliberately not fixed here

Both are outside this ticket's AC — happy to file them:

  • TransitionCreationPresentation has the identical missing minDate on its own checkDate, and TransitionCreation already computes minCheckDate. Same bug, different flow.
  • Correction payrolls forbid a future startDate (enforced in the schema) with no maxDate on that picker.

OffCyclePayPeriodDateForm rendered the payment-date field with no minDate, so
the earliest-valid-check-date rule existed only as a submit-time validation
error: you could pick a past date, submit, and only then be told it was invalid.
Legacy gws-flows disables invalid dates in the picker.

The bound was already being computed -- OffCycleCreation gets { minCheckDate,
today } from useOffCyclePayPeriodDateValidation and feeds it to the zod resolver
as `isCheckOnly ? today : minCheckDate` -- it just never reached the field. Thread
both dates container -> presentation and apply the same expression as minDate, so
picker and validation cannot disagree and checking "check-only payroll" widens the
bound back to today, live.

Not touched, same class of gap but outside this ticket's scope:
TransitionCreation's checkDate field (which likewise already computes
minCheckDate), and the future-startDate rule for correction payrolls, which has no
maxDate on its picker.
@krisxcrash
krisxcrash marked this pull request as ready for review August 27, 2026 18:44
@krisxcrash
krisxcrash requested a review from a team as a code owner August 27, 2026 18:44
@krisxcrash
krisxcrash enabled auto-merge August 27, 2026 20:59
@krisxcrash
krisxcrash added this pull request to the merge queue Aug 27, 2026
Merged via the queue into main with commit ef5c887 Aug 27, 2026
31 checks passed
@krisxcrash
krisxcrash deleted the kw/fix/sdk-1274-payment-date-missing-minimum-date branch August 27, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants