Skip to content

Prevent future dates in date of birth picker#2955

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

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

Conversation

@HeyangQin
Copy link
Copy Markdown

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
@ellykits ellykits requested a review from LZRS March 26, 2026 10:13
@ellykits
Copy link
Copy Markdown
Contributor

Thanks @HeyangQin for this PR. @LZRS, please check if this functionality works on the data capture Kotlin multiplatform version and if we added tests for the same.

Copy link
Copy Markdown
Contributor

@LZRS LZRS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @HeyangQin

@github-project-automation github-project-automation Bot moved this from New to PR under Review in Android FHIR SDK Apr 1, 2026
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

3 participants