Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Metaobject date time field incorrect output when date different in UTC than local timezone

Metaobject date time field incorrect output when date different in UTC than local timezone

colins8
Shopify Partner
3 0 2

Screenshot 2023-08-22 at 10.38.19.png

In a metaobject I have a date time field. The UI shows the store timezone EDT to the right of the time field. If I select a time in EDT that would mean the UTC date is different (e.g. any time 8pm or after means UTC would be the next day, 23rd of August), then when I render the field in liquid the output is incorrect (it is 24 hours off).

 

{{ start }} = 2023-08-22T00:00:00Z
{{ start | metafield_tag }} = <time datetime="2023-08-22T00:00:00Z" class="metafield-date_time">Aug 22, 2023, 12:00 am</time>
{{ start | date: "%Y-%m-%dT%H:%M:%S%z" }} = 2023-08-21T20:00:00-0400
{{ start | date: "%s" }} = 1692662400
Expected to output:

 

 

2023-08-23T00:00:00Z​

 

 

 

 

Replies 4 (4)

colins8
Shopify Partner
3 0 2

There also seems to be a UX issue with the metaobject field, presumably related. Is the UI rendering a different date than is being saved under the hood? https://www.loom.com/share/c58f697d53fc4ad68372e8c3054014a6?sid=d5fc245e-09e0-45f1-be53-356728ec3aa0

SPB
Shopify Partner
5 0 2

Experiencing the same. Although we're using a DateTime metafield set to AEST and it is rendering 11 hours behind. e.g. 7pm renders as 8am the same day. 

 

I've submitted a ticket to Shopify Support 

Co-Curator
Shopify Partner
2 0 0

Having the same issue here with 'date and time' metafield. The store time zone is PST. The metafield time selected is noted as PST. When linked to a text field as a dynamic source the output is 8 hours ahead (presumably UTC).

dlandmann
Shopify Partner
6 0 0

Having the same issue with datetime in metaobjects. News about this???