Skip to content

feat: disable past dates in Pay Schedule first pay date picker#1410

Merged
larchai merged 7 commits intomainfrom
feat/SDK-530-disable-past-dates-pay-schedule-v2
Mar 30, 2026
Merged

feat: disable past dates in Pay Schedule first pay date picker#1410
larchai merged 7 commits intomainfrom
feat/SDK-530-disable-past-dates-pay-schedule-v2

Conversation

@larchai
Copy link
Copy Markdown
Contributor

@larchai larchai commented Mar 30, 2026

Summary

  • SDK-530: Disables past dates in the Pay Schedule "First pay date" picker via new minDate, maxDate, and isDateDisabled props on the DatePicker component adapter
  • SDK-592 (partial): Dynamically renders processing time copy ("1 day" / "2 days" / "4 days") based on company ACH speed instead of hardcoding "2 days" — Pay Schedule component only
  • Copilot fix: dateToCalendarDate uses local date methods instead of UTC-based formatDateToStringDate to avoid timezone shift bug

Identical changes to #1311, rebased onto main from the upstream repo (not the fork) to resolve merge blocking.

Test plan

  • Verified 2-day ACH company shows "2 days" processing time in Pay Schedule
  • Verified 4-day ACH company shows "4 days" processing time in Pay Schedule
  • Past dates disabled in first pay date picker confirmed visually
  • 1-day ACH variant untestable in demo (requires partner opt-in) — code review confirms singular "1 day" i18n key

🤖 Generated with Claude Code

larchai and others added 7 commits March 30, 2026 16:07
Adds minDate, maxDate, and isDateDisabled props to the DatePicker
component adapter interface, and uses minDate on the Pay Schedule
anchorPayDate field to prevent selection of past dates.

Also adds Zod validation on anchorPayDate as a safety net for
programmatic submissions.

Resolves SDK-530

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Reuse existing formatDateToStringDate utility in dateToCalendarDate
  instead of duplicating date string formatting logic
- Revert Zod schema validation for anchorPayDate — the UI constraint
  (minDate) is sufficient and adding validation would require
  dynamic schema for i18n support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Regenerates component-inventory.md to include the new minDate,
maxDate, and isDateDisabled props added to DatePickerProps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fetches company payment speed via usePaymentConfigsGet and renders
the Pay Schedule first pay date description dynamically (1/2/4 days)
instead of hardcoding "2 days". Falls back to 2 if unavailable.

Uses i18next count-based pluralization for correct "day" vs "days".

Partially addresses SDK-592 (Pay Schedule only; Off-Cycle Pay Period
and Contractor Payments still have hardcoded copy)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use local date parts (getFullYear/getMonth/getDate) instead of
  formatDateToStringDate which uses toISOString (UTC). This prevents
  timezone-related off-by-one errors where evening times in US
  timezones would shift to the next day in UTC.
- Return undefined instead of throwing on invalid dates, since
  minDate/maxDate come from external adapters and an invalid value
  should not crash rendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds two test cases proving that formatDateToStringDate (which uses
toISOString/UTC) can return a different calendar date than the user's
local date. This documents the latent bug that motivated using local
date extraction (getFullYear/getMonth/getDate) in dateToCalendarDate.

Also includes auto-generated i18next type update for pluralized
anchorPayDateDescription keys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove conditional test cases that were used to locally prove the
UTC timezone bug in formatDateToStringDate. As Steve noted, conditionals
in tests are bad practice — these served their purpose as local proof
and don't belong in the test suite.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@larchai larchai merged commit f4ab2e1 into main Mar 30, 2026
17 checks passed
@larchai larchai deleted the feat/SDK-530-disable-past-dates-pay-schedule-v2 branch March 30, 2026 21:20
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