Magento: Correcting for Timezone Issues

Symptoms

When using date-based logic on Magento the available delivery days are incorrect and the cut-off time is not being obeyed correctly. For example, when Sunday is selected as a blacked out delivery day Saturday is blacked out and Sunday is available.

Cause

This is caused by a mis-match in the time zones between ShipperHQ and Magento. If the selected timezone in ShipperHQ is set to GMT+2, for example, then Magento will also need to be set to GMT+2.

This also occurs when using a UK timezone. In the summer time Magento does not account for Daylight Savings Time and remains at GMT+0. However, if you have ShipperHQ set to “Europe/London” that particular timezone does account for daylight savings so it uses GMT+1 during BST.

The available dates are offset because the days are calculated from 00:00:00 to 23:59:59. So, when BST (GMT+1) is 00:00:00 on one day, GMT+0 is 23:00:00 from the previous day.

When using London’s time zone in ShipperHQ this can be tested by changing the timezone within Magento to Cape Verde Standard Time, which is specifically GMT+1.

Solution

To resolve this the time zones will need to match between ShipperHQ and Magento.

For the UK, you will need to:

Set Magento to: GMT

Set ShipperHQ to: GMT

During BST: Decrease cutoff times by 1h

During GMT: Set cutoff time to actual time you would like the cut off to apply