Trouble on conditions based on dates

Hello, we’ve been trying to display buttons based on 3 dates:

  • Today
  • final_registration_date field value
  • end_date field value

Both fields are setup in the ACF_Academies group field. We did a lot of tests but something seems off;

Ex : “La date d’inscription est passée.” text display while the condition is TODAY AFTER {{dc:acf:post_field field=“final_registration_date”}} and {{dc:acf:post_field field=“final_registration_date”}} equals “29 juin 2030”.This text is supposed to show up only when the registration date is in the past…

I feel like this is a format issue but the format is j F Y everywhere (on the fields and in wordpress settings)
Do you have an idea?

Hello @deciplex,

Thank you for the inquiry.

It’s not working because acf.post_field({“field”:“final_registration_date”}) returns a date in French, for example 29 juin 2030, which is not recognized by the Datetime condition options. You may need to create another ACF field with the same date value, formatted in English.

Let us know the result.

Best regards,

You mean in m/d/Y format ? Is this why the type=“date” format=“M D” would not work in cornerstone ?

I’d rather use english format in the ACF settings and then, format my date to match my needs than create another ACF field.

I finally succeeded, so I’ll detail it for anyone it might help. I changed my ACF fields to use date and time, with the return format set to d/m/Y g:i a.

From Cornerstone, I set up my conditions like this, selecting Datetime as the condition type:

{{ global.date({“format”:“Y-m-d H:i:s”}) }} BEFORE {{dc:acf:post_field field=“final_registration_date” type=“date” format=“Y-m-d H:i:s”}}

The syntax wasn’t obvious, and honestly the condition popup doesn’t help—it’s hard to read, too small.

Thanks for checking it out.

Glad to know you figured it out. Did you end up switching the date format to English? Thanks for sharing.

As I said, the return format on these fields is d/m/Y g:i:a so english format by using the slash and the am/pm method.

Hi @deciplex,

Thanks for the information.