Date xlsform calculation code to not allow age less than 15 for household owner

1. What is the problem? Be very detailed.
Household owner date of birth should not give an age less than 15 from the day of collection
2. What app or server are you using and on what device and operating system? Include version numbers.
Server : and clients either Kobocollect or form web link :
3. What you have you tried to fix the problem?
I need to calculate the proper household birth date selected from calendar as well as difference of number days between collection date and the household owner birth is not less than 15 years days (15 years x 365 days= 5 475 days)
4. What steps can we take to reproduce the problem?
When Surveyor reach to household owner date of birth field in calendar format and select in date less than 15 years, an alert message should notify that "It is wrong date, birth date should not be less than 15 years old)
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
Please find print screen of date of birth calendar format field on survey form

Date of birth to not allow age less than 15 years.docx (47.0 KB)

Thanks for your support

You can use this constraint .<=today()-5478.

It works fine. Thank you.

It might also be of interest for you to know where the 5478 came from.

In excel, using the convert function, you can parse year number into any other value formats like day, month and more. So in case you want to raise or reduce the threshold from 15yrs to 20 or less you shall get the constraint value to be lessened from today() by using =convert(x,"yr","day") where x is the number of years to convert


1 Like

Thank you, I will what you this constraint. Thankx too much I appreciate.

Thanks so much for for your further clarification.