Hello,
Thanks for the report. I’ve answered you on Slack, but I’ll copy paste my answer here, so it can help other users too ??
The Advanced Validation feature is here to let people quickly setup custom validation on field, using an UI (instead of adding code). The UI doesn’t support the comparison with other fields.
Here is an example of Advanced Validation Usage. If the user type “Hello” in the text field, then the error "Hello" is not allowed. Type something else.
will be displayed
Screenshot: https://i.imgur.com/wVeC5CX.png
In your case, you’re using “Date” field. If you want to compare date value, you have to know how it is saved in the database. To do so, you can create a “test field group”, with one single field: “Date”. Create a new page, and enter a value inside the “Date” field, then save the page.
Go in your functions.php
file and add the following line: define('ACFE_dev', true);
. Then save the save file, and refresh your admin page.
This will enable the “ACF Extended: Dev Mode”. You’ll now see what data are saved in any admin page. For our example:
Screenshot: https://i.imgur.com/LKzkJ3X.png
As you can see, the format saved is kinda “custom”, ACF is saving the date value in the following format: 20200501
Ymd
(YearMonthDay). It is also explained in the field documentation here: https://www.advancedcustomfields.com/resources/date-picker/
This format has been chosen, so the developer can easily sort/compare data. In your case, you can specify:
If value <= 20200509 | error: "Please select a date after the 09/05/2020"
Screenshot: https://i.imgur.com/WrpMvP1.png
Screenshot: https://i.imgur.com/qF5QCV4.png
If you want to create a dynamic validation, based on a dynamic date from an another field, you’ll have to add some code, as it can’t be done from the UI.
Here is the documentation: https://www.advancedcustomfields.com/resources/acf-validate_value/
Hope it helps!
Have a nice day.
Regards.