Skip to content

[persons] Let datetime validate interval helper inputs#1151

Merged
frankrousseau merged 1 commit into
cgwire:mainfrom
frankrousseau:allow-future-day-offs
Jul 10, 2026
Merged

[persons] Let datetime validate interval helper inputs#1151
frankrousseau merged 1 commit into
cgwire:mainfrom
frankrousseau:allow-future-day-offs

Conversation

@frankrousseau

@frankrousseau frankrousseau commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problems

  • The date interval helpers enforced an arbitrary year range (2010 to the current year), so viewing a future month (e.g. day offs for 2027/01 while in 2026) raised WrongDateFormatException and a 500.
  • The manual bounds let impossible dates through (Feb 30, non-numeric input, ISO week 53 wrongly rejected), which crashed later with unhandled errors.

Solutions

  • Drop the year-range policy from the interval helpers: build the interval and let datetime validate, converting ValueError into WrongDateFormatException (400 in the routes that catch it).

@frankrousseau
frankrousseau force-pushed the allow-future-day-offs branch from 5d5089e to aa21e36 Compare July 10, 2026 11:56
get_month_interval and the year/week/day helpers enforced an arbitrary
year range (2010 to the current year), so viewing a future month (e.g.
day offs for 2027/01 while in 2026) raised WrongDateFormatException and
a 500, while genuinely impossible dates slipped through the manual
bounds (Feb 30 passed the day <= 31 check and crashed, non-numeric
input crashed before the check, ISO week 53 was wrongly rejected).
Drop the range policy: build the interval and let datetime decide,
converting ValueError into WrongDateFormatException.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@frankrousseau frankrousseau changed the title [persons] Allow day offs and schedules in future years [persons] Let datetime validate interval helper inputs Jul 10, 2026
@frankrousseau
frankrousseau force-pushed the allow-future-day-offs branch from aa21e36 to c270531 Compare July 10, 2026 12:22
@frankrousseau
frankrousseau merged commit e01ea95 into cgwire:main Jul 10, 2026
2 checks passed
@frankrousseau
frankrousseau deleted the allow-future-day-offs branch July 10, 2026 12:46
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.

1 participant