Why isn't my date metafield formatting correctly?

Topic summary

A Shopify product date metafield would not format via the Liquid date filter, returning the raw ISO‑8601 string instead of a formatted date. Using the metafield’s .value (the date object) resolves formatting, and metafield_tag provides semantic HTML formatting.

A follow‑up revealed times rendering ~4 hours ahead (UTC) despite the shop’s Eastern Time setting. A Shopify Metafields team member confirmed this is a bug: date metafields weren’t respecting the shop timezone. A fix was filed; interim workaround is to convert the value to a string before formatting (append: “”) so the shop timezone is used. The workaround was confirmed to work.

Sorting by a product metafield date isn’t currently supported with Liquid’s sort filter. The request to allow sorting on metafield values was relayed to the team.

Additional user notes: one reported a “JSON: Unexpected token” error when trying the first approach (unresolved in-thread). Others requested DD/MM/YYYY display options and shared a video tutorial; one commenter advocated using ISO 8601 (YYYY‑MM‑DD) for clarity. Screenshots were used to illustrate the timezone discrepancy.

Status: Bug acknowledged with a workaround; official fix pending. Open questions remain on the JSON error and broader date-format customization.

Summarized with AI on December 25. AI used: gpt-5.

Hey @DevBijan , this is Matt from the Metafields team.

You’re right, this is odd—piping a ISO-8601 string to the date filter should output the formatted date, like you’ve tried. I’ll look into why this isn’t working as expected. Can you point me to the docs that outlined this example?

In the meantime, you have a couple options. The first is access the date object by appending .value. This will return the date object, and allow you to format the date:

{{ product.metafields.my_fields.class_date.value | date: "%a, %b %d, %Y" }}

The other option is piping the metafield through the metafield_tag filter. This will automatically format the date using semantic HTML, but it won’t give the fine grained control you’re probably looking for.

{{ product.metafields.my_fields.class_date | metafield_tag }}

I hope this helps!

1 Like