Date constraint expression under relevance without a year

02-03-2023 11:19 AM
New Contributor

Hello all,

In Survey123 Connect, I'm currently trying to limit which days a certain service request type is available. It needs to be available from May 25th to September 30th of each year.

However, I can't figure out how to do this without putting in a specific year, as follows: 

${RECDATETIME} >= date('2023-05-25') and ${RECDATETIME} <= DATE('2023-09-30')

I'd prefer to not have to come back each year and change the year! Essentially, the year is irrelevant as long as it's the current year. It needs to be 05-25 to 09-30 every year.

Is there some syntax or something I can use to do this? I've tried formatting the date as only month-date, but when this happens, it seems like any date and year works!

Thank you,


0 Kudos
1 Reply
Occasional Contributor III

You should be able to pull the current year by using format-date(now(), "%Y"), so if your month-date calculation was working correctly you might be able to add a calculation that checks that the input year is equal to the above value? That being said I can't work out how to put that logic within a constraint on the date field itself, instead having it as a text or note (no field created in resulting service, so cleanest option) field underneath. Like so



And you could add a constraint message saying "Date not within current year" so users would know why it failed. Not sure if this is the most efficient way of doing it but it would work, hope that helps!

0 Kudos