Join the Webstudio community

Updated 2 months ago

Date Format for WordPress CMS

At a glance

The community member is setting up a site and needs to reformat the date format received from Wordpress via GraphQL into a YYYY-MM-DD format. The comments suggest using the Time component, but the formatting options are limited. Another community member notes that the date format should adapt to the specified language, as a single format may not work for everyone. The Time component uses the native Intl.DateTimeFormat API, which provides more customization options.

Useful resources
Hey All, I'm setting up a site and need to work out the date format I'm receiving from Wordpress via GraphQL. How can I reformat this within the expression editor into a YYYY-MM-DD format?
Attachment
Screenshot_2024-12-17_at_20.09.53.png
B
B
4 comments
Pass it to Time component
That worked, but how do I set the formatting to be exactly how I want it? It appears the options are limited, and I can't add a custom option
Format adapts to specified language. It is never a good idea to use single format for everybody. For example 11.12.24 can mean different dates in europe and us
Add a reply
Sign up and join the conversation on Discord