🔞 Update "short" demo survey so people born in 2006 can take it #1131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The short version of the demographics survey asks for year of birth and we restrict the valid range of responses so as to not allow participants younger than 18. Last year when I uploaded this, I wrote in 2005 as the upper limit. But theoretically, people born in early 2006 can now participate in those studies.
I found a more generic solution using the ODK forms constraint syntax and some built-in functions they have:
. > 1900 and . + 18 <= format-date(today(), '%Y')
So now we won't have to update this every year; it actually takes into account the current year when validating the form.