Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hi,
I have a shop that runs in the CET timezone in winter time and CEST in summer time.
Will I be able to use the shop/update webhook to detect the implicit system timezone change, or do I need to handle it in some other way?
Thanks,
-Louise
Solved! Go to the solution
This is an accepted solution.
Hey Louise,
Nothing will fire unless they manually update the timezone.
Scott | Developer Advocate @ Shopify
This is an accepted solution.
Hey Louise,
Nothing will fire unless they manually update the timezone.
Scott | Developer Advocate @ Shopify
Hi Scotty,
Ok, thank you for your answer.
-Louise
...by the way, I see that there's a field timezoneOffsetMinutes on the shop, so I assume that parameter will return different values depending on whether it's summer time or not for e.g. a Danish shop? I.e. I could query that parameter regularly to determine whether it's summer time or not.
Hey @Louise_Elmose_H
Can you elaborate on the use case? There might be a simpler way to solve this.
Scott | Developer Advocate @ Shopify
Thanks for the summary. Are you able to store dates as UTC and then use JavaScript to display them in the user's timezone (assuming this is happening in-browser)?
Scott | Developer Advocate @ Shopify
Hi Scotty,
I do store dates in UTC and display them in local time via Javascript, but in addition to that I need to e.g. update orders for a specific time period, generate a report for a specific time period etc., and I would like that to be in local time as well, hence my problem.
The business logic of the app is only relevant for Denmark due to accounting rules, so for this reason I know the locale should be Danish.
Thanks,
-Louise
Ah I see. In that case it might make sense to store the iana_timezone (more info) and using a library to do the math for you.
Here's an example using JS and the Moment.js library:
const localTime = moment(1489199400000).tz('Australia/Brisbane')
If you get stuck, let me know the language and I'll look for an example.
Scott | Developer Advocate @ Shopify
Ah ok, that's the moment-timezone library then? I've been using moment so far.