Disable module date selection outside program duration#3424
Disable module date selection outside program duration#3424kasya merged 5 commits intoOWASP:mainfrom
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughAdds program start/end dates to GraphQL queries and threads formatted Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/src/components/ModuleForm.tsx (1)
223-236: Clamp end-date min to the program start.If an existing module has
startedAtbefore the program start,min={formData.startedAt || minDate}allows selecting end dates earlier than the program start. Consider clamping to the later ofminDateandstartedAtso the end-date picker can’t go outside the program window. Line 234 is the key spot.🛠️ Suggested adjustment
+ const endDateMin = + minDate && formData.startedAt + ? (formData.startedAt > minDate ? formData.startedAt : minDate) + : formData.startedAt || minDate || undefined ... - min={formData.startedAt || minDate || undefined} + min={endDateMin}
c511d24 to
b5f400c
Compare
b5f400c to
8fc947e
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/src/components/ModuleForm.tsx (1)
209-236: Min/max aren’t enforced for typed input withnoValidate.Because the form disables native validation, users can still type/paste out‑of‑range dates even though the picker UI is constrained. Consider adding explicit range checks in the custom validators (e.g.,
validateStartDateLocal/validateEndDateLocal) whenminDate/maxDateare present.
|
kasya
left a comment
There was a problem hiding this comment.
This is great @mrkeshav-05 👍🏼
Thanks!



Proposed change
This PR fixes the issue and disable module date selection outside program start and end dates.
Resolves #3382
Checklist
make check-testlocally: all warnings addressed, tests passed