Will the shop/update webhook fire for shops when timezone changes?

Solved
Louise_Elmose_H
Shopify Partner
65 2 7

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

0 Likes
SBD_
Shopify Staff
Shopify Staff
1044 141 183

This is an accepted solution.

Hey Louise,

 

Nothing will fire unless they manually update the timezone.

0 Likes
Louise_Elmose_H
Shopify Partner
65 2 7

Hi Scotty,

 

Ok, thank you for your answer.

 

-Louise

0 Likes
Louise_Elmose_H
Shopify Partner
65 2 7

...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.

0 Likes
SBD_
Shopify Staff
Shopify Staff
1044 141 183

Hey @Louise_Elmose_H 

 

Can you elaborate on the use case? There might be a simpler way to solve this.

0 Likes
Louise_Elmose_H
Shopify Partner
65 2 7
Hi Scotty,

I want to format certain dates that are persisted in UTC in the timezone for a given shop, so times are displayed as local times. In Denmark though the timezone I CET in winter time and CEST in summer time. So I need to know what the timezone is the day that I format the time. For this reason I think I need to query the shop to determine whether we are currently in CET or CEST in Denmark.

Thanks,
Louise
0 Likes
SBD_
Shopify Staff
Shopify Staff
1044 141 183

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)?

0 Likes
Louise_Elmose_H
Shopify Partner
65 2 7

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

0 Likes
SBD_
Shopify Staff
Shopify Staff
1044 141 183

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.

 

 

 

0 Likes
Louise_Elmose_H
Shopify Partner
65 2 7

Ah ok, that's the moment-timezone library then? I've been using moment so far.