How to Correct Timezone Issues for Magento
Align Magento and ShipperHQ timezones to ensure accurate delivery dates and cutoff times
Table of Contents
Overview
When using date-based logic on Magento, you might notice that available delivery days aren't displaying accurately, and cut-off times might not function as expected. For example, Sunday might be selected as a blackout delivery day, yet Saturday is unavailable, and Sunday remains open.
Cause of a Timezone Issue
A mismatch in time zones between ShipperHQ and Magento causes these issues. If ShipperHQ is set to GMT+2, Magento must also match GMT+2. During summer, Magento does not adjust for Daylight Savings Time and stays at GMT+0. Conversely, if ShipperHQ is set to "Europe/London," it accounts for Daylight Savings, switching to GMT+1 during BST. This discrepancy results in offset dates since days are calculated from 00:00:00 to 23:59:59. For BST (GMT+1), 00:00:00 of one day equals 23:00:00 of the previous day under GMT+0. This can be tested by setting Magento's timezone to Cape Verde Standard Time, matching GMT+1.
Solution
To fix this, ensure that the time zones match between ShipperHQ and Magento. Here's what you need to do if you're in the UK:
- Set Magento to: GMT
- Set ShipperHQ to: GMT
- During BST: Decrease cutoff times by 1 hour
- During GMT: Set the cutoff time to the desired actual time
By aligning these settings, your delivery days and times will display correctly 😊