Skip to content

Add dob limit - #1821

Open
david-roper wants to merge 2 commits into
DouglasNeuroInformatics:mainfrom
david-roper:add-dob-limit
Open

david-roper wants to merge 2 commits into
DouglasNeuroInformatics:mainfrom
david-roper:add-dob-limit

Conversation

@david-roper

@david-roper david-roper commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The Start Session form now rejects a subject date of birth in the future.

Until now, any date was accepted, so a typo such as 2062 instead of 1962 started a session and stored an impossible birth date on the subject. The date of birth field now shows "Date of birth must be in the past" and the form won't submit until it's corrected.

  • Applies to both identification methods (custom ID and personal information).
  • Today's date is still accepted.
  • The message is translated: La fecha de nacimiento debe estar en el pasado (es) and La date de naissance doit être dans le passé (fr).
  • The existing minimum-age check for groups with minimumAge set is unchanged and still runs after this one.

Changes

File Change
apps/web/src/components/StartSessionForm/StartSessionForm.tsx subjectDateOfBirth gets .max(currentDate, …) with the translated message.
apps/web/src/components/StartSessionForm/__tests__/StartSessionForm.test.tsx Two unit tests: a future date of birth is rejected with the message on the date field and nothing is submitted; a past date of birth still submits.
testing/src/specs/start-session.spec.ts E2E: entering a future date of birth through the form shows the message and doesn't start a session.
testing/src/pages/_app/session/start-session.page.ts New fillDateOfBirth(date). It fills the date and then blurs the input, because libui's date input only commits typed text when it loses focus.

Test plan

  • pnpm lint passes for web and testing
  • Unit: StartSessionForm.test.tsx passes (29 tests)
  • E2E: start-session.spec.ts passes in Chromium (28 tests)
  • Full pnpm test:coverage and pnpm test:e2e
  • Manual: on Start Session, enter a date of birth next year and submit; the message appears and no session starts. Change it to a past date and the session starts.

Notes for reviewers

  • The existing fillSubjectDetails() page-object helper fills the date of birth and then selects the sex, without blurring the date input in between. Its date is therefore probably never committed. The tests using it pass anyway because date of birth is optional with a custom ID. A follow-up could switch it to fillDateOfBirth(); this PR leaves it alone to stay small.
  • Locally, the API dev server can take more than 10 seconds to start, which is longer than the per-server timeout in testing/playwright.config.ts, so e2e runs can fail before any test starts. That's unrelated to this change and isn't touched here.

🤖 Generated with Claude Code

Closes issue #1820

This branch has not been deployed

No deployments
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