Date validation to specific day of the week in the past

(Tony) #1

Hi,

Is it possible to limit a date field to a specific day of the week in the past. We’d like to build a date validation to only accept Fridays in the past. Is this possible? Any thoughts?

Thanks,

Tony

0 Likes

(Ethan Soergel) #2

Yes, this is possible - you can use format-date to get the day of the week as an integer. Sunday is 0, so Friday is 5. This should work for your validation condition:

format-date(#form/your/question, “%w”) = “5”

You can also use “%a” or “%A” as that second argument to return “Fri” or "Friday, respectively. I believe that changes depending on the language though, so I’d advise using “%w” for an integer value.

1 Like

(Tony) #3

Thank you @Ethan_Soergel

0 Likes