Javascript to calculate user's age, based on DOB, and branch respondent to correct survey | XM Community
Skip to main content
Solved

Javascript to calculate user's age, based on DOB, and branch respondent to correct survey

  • September 18, 2018
  • 1 reply
  • 56 views

A major goal of our recruitment survey is to identify the exact age of respondents in days then branch them to a survey based on exact age (we have multiple surveys between birth and older than 4 years old). Currently we ask participants for their date of birth (MM/DD/YYYY) and would like to use JS to: Calculate age (in days), based on the current date Branch participants based on age (in days) to the correct survey. For example: based on date of birth, we would want to know the patient is between 1,050 days and 1,185 days old to be eligible to take our survey for 36 month olds, where we would then branch the respondent to that particular survey.

Best answer by PeeyushBansal

Check below link https://www.qualtrics.com/community/discussion/1397/javascript-to-calculate-users-age-based-on-dob-check-age-eligibility-provide-validation-alert

1 reply

PeeyushBansal
Level 6 ●●●●●●
Forum|alt.badge.img+44
  • Level 6 ●●●●●●
  • Answer
  • September 18, 2018
Check below link https://www.qualtrics.com/community/discussion/1397/javascript-to-calculate-users-age-based-on-dob-check-age-eligibility-provide-validation-alert