Skip to content

Prevent future dates in date of birth picker#2955

Open
HeyangQin wants to merge 2 commits intoohs-foundation:masterfrom
HeyangQin:fix/prevent-future-dob
Open

Prevent future dates in date of birth picker#2955
HeyangQin wants to merge 2 commits intoohs-foundation:masterfrom
HeyangQin:fix/prevent-future-dob

Conversation

@HeyangQin
Copy link

Summary

  • Add maxValue extension with cqf-calculatedValue of today() to the birthDate field in the patient registration questionnaire
  • The date picker already supports maxValue constraints via DatePickerViewHolderFactory.getSelectableDates() — the questionnaire simply didn't include one
  • No code changes needed — the fix is purely in the questionnaire JSON definition, following the standard FHIR extension pattern

Test plan

  • All MaxValueValidatorTest tests pass — confirms cqf-calculatedValue with date constraints works correctly
  • All datacapture unit tests pass
  • Manual: open demo app, tap '+' to add patient, verify date picker does not allow selecting future dates for date of birth

Closes #835

Add maxValue extension with cqf-calculatedValue of today() to the
birthDate field in the patient registration questionnaire. The date
picker already supports maxValue constraints — the questionnaire
simply didn't include one.

Closes ohs-foundation#835
- Future date (tomorrow) with maxValue of today() returns invalid
- Today's date with maxValue of today() returns valid
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.

On Add patient screen, Able to select future date as date of birth while adding and editing patient

1 participant