fix(SDK-1274): disable invalid payment dates in the off-cycle picker - #2650
Draft
krisxcrash wants to merge 1 commit into
Draft
fix(SDK-1274): disable invalid payment dates in the off-cycle picker#2650krisxcrash wants to merge 1 commit into
krisxcrash wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes SDK-1274 (Medium, Pay v2 / RRoP Test Fest).
Root cause
OffCyclePayPeriodDateFormPresentationrendered the payment-date field as a bare<DatePickerField name="checkDate" ... />with nominDate, 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 —
OffCycleCreationgets{ minCheckDate, today }fromuseOffCyclePayPeriodDateValidationand feeds it to the zod resolver asisCheckOnly ? today : minCheckDate. It just never reached the field.minDateis already onDatePickerPropsand passes straight throughDatePickerFieldProps, so the plumbing existed too.(Confirmed "Payment date" is the
checkDatefield —Payroll.OffCyclePayPeriodDateForm.json→checkDateLabel.)Fix
Thread both dates container → presentation, matching the container/presentation split used elsewhere here, and apply the same expression the resolver uses:
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-disabledpattern theDatePickerUI 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:I verified both tests fail when the
minDateline 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:
TransitionCreationPresentationhas the identical missingminDateon its owncheckDate, andTransitionCreationalready computesminCheckDate. Same bug, different flow.startDate(enforced in the schema) with nomaxDateon that picker.