Date comparison with ACF date field don't work

Hello,

Since the last release, this tag doesn’t work anymore :

<If acf_date=my_custom_acf_date_field after=today>

Could you check asap please ?

Hi @bikloz,

There was a breaking change in the latest release:

ACF integration

  • Breaking change: Date field types now get their default formatting from the field setting for Return Format. Previously the defaults were from site setting (Date field), “Y-m-d H:i:s” (Date/Time), and “H:i:s” (Time). Now they use the selected format in each field’s settings, or ACF’s default return format: “d/m/Y” (Date), “d/m/Y g:i a” (Date/Time), and “g:i a” (Time).

You can either downgrade the plugin as a temporary fix or update your logic to accommodate.

2 Likes

I’ve read that note but what is the new logic now to make this tag work ?

@bikloz I just tested this myself and was able to confirm that date conditionals seem to have been overlooked in the modifications to the ACF date/time fields. I’ve reported the issue here on Github.

I think in this case it’s an actual bug/oversight, but I imagine there are going to be some other people whose templates might be affected by the format change and who might need to update their templates, so thanks for sharing that tip. I think for the most part, if anyone runs into issues with their ACF date fields when updating to 4.1.0, the easier solution will probably be to simply change the “return format” for that field in their ACF settings to make it match whatever the date format in their WP site setting is. This “return format” setting didn’t use to do anything, but in the latest release, L&L actually respects the ACF setting the person has chosen.

2 Likes

Yeah, I also meant this but I was too lazy to explain it properly. :sweat_smile:

1 Like

Thanks for these answers. Actually I have the ACF repeater issue too so I rollback and wait for the next release :wink:

2 Likes

@bikloz the 4.1.1 update should fix this issue, let me know if you notice anything else we need to address.

ACF integration: Date field types: Ensure unformatted value is passed to date conditions

1 Like

Yes, it works now. Thank you Benjamin :+1:

1 Like