Beta 8: Dynamic date going against the set Date format?

Hi!

This example is on Modern Events Calendar. I have sucessfully activated the Looper Provider on the Container, and started to pull in stuff from MEC. No problem with the Featured Image, Title, Event link, Excerpt etc.

However, the Dates are the problem:

{{dc:post:meta key="mec_start_date"}}

The returned format is this: 2020-11-10

WordPress date format is set like this:

image

MEC has these options:

image

Those are all date settings, and all are set to show d M Y.
The site Language is set to native language, not English.

Yet the Dynamic Content is pulling the date wrongly.

I have tried to add format='D/ M / Y' to the shortcode, but that didn’t helped as well.

Am I doing something wrong, or this is a bug?

Thanks!

Hi @Misho,

When you do {{dc:post:meta key="*"}} it just pulls through the raw post meta data. MEC doesn’t have the opportunity to apply formatting, and the value is treated as a string. So it’s “working” as intended but there isn’t a chance for the string to be formatted. Adding format='D/ M / Y' only works on Dynamic Content items that are already being treated as a date.

To give some more flexibility here, I’ve added a type argument for the next patch. If the value is date or time it will allow passing format and fallback to default format configured in WordPress.

{{dc:post:meta key="*" type="date"}}
{{dc:post:meta key="*" type="time"}}
{{dc:post:meta key="*" type="date" format="D/ M / Y"}}

It still won’t use the MEC settings (we’d need to add MEC specific Dynamic Content rules for that) but at least you have more control over the output.

3 Likes

@alexander, works like a charm! Thanks! :+1:

Great! Thanks for confirming.

1 Like