Date range

At this point the Conditional Fields plugin is unaware of date ranges, but this is a problem that can be solved with custom functions. Custom functions are available in Conditional Fields Pro. Check out the example below.

Form

Enter a date between 29-Aug-2019 and 7-Sept-2019:

Well done!

Form Code

[group nope]Enter a date between 29-Aug-2019 and 7-Sept-2019:[/group]
[date date]
[group well-done]Well done![/group]

Conditional Fields (export)

show [well-done] if [date] function "date_between"
show [nope] if [date] function "not_date_between"

In order for this form to work you need to add this javascript code to your theme:

<script> fromdate = new Date(2019,7,29); untildate = new Date(2019,8,7); function date_between($field) { //expected format: yyyy-mm-dd var checkdate_str = $field.val(); var dmy = checkdate_str.split("-"); if (dmy.length !== 3 || isNaN(dmy[0]) || dmy[0].length!==4 || isNaN(dmy[1]) || dmy[1].length!==2 || isNaN(dmy[2]) || dmy[2].length!==2 ) { return false; //invalid format } var checkdate = new Date(dmy[0], dmy[1] - 1, dmy[2]); if (checkdate === "Invalid Date" || isNaN(checkdate)) { return false; // invalid date } //at this point the date is valid if (checkdate > fromdate && checkdate < untildate) { return true; // date is between the from and until date } else { return false; // date is not between the from and until date } } function not_date_between($field) { return !date_between($field); } </script>