How to constraint an input (date) that is greater than the date entered previously but should be smaller or equal to the date entered today?

Condition: “Date must be between the date when the sample was collected and today.”

Had tried many formulas to no avail. Attached here is the error notification. Need help please.

!

Welcome to the community, @cta_cfah_2020! So you mean the data could be a past date or todays date but it should not allow future dates?

Welcome,
Would you mind to give the search function of this forum a trial, please?
https://community.kobotoolbox.org/search?q=date%20validation

Hi @cta_cfah_2020, please refer to the support docs regarding validation:

https://support.kobotoolbox.org/validation_criteria.html#example-validation-criteria

In essence, you can do the following to solve your issue:

type name label constraint
date a_date When did it happen?
date another_date When did something else happen? . > ${a_date} and . <= today()
2 Likes

Yes. The date of counting should be after the date of taking sample & today.

This is the validation code I had: .<=${today} and .>date(‘sampling_date’)

where sampling_date is the name of Q6.

Thanks so much Josh. A lifesaver. It worked

2 Likes