Problem/Motivation
The date fields store the given date & time in UTC. Currently the module does not specify the time zone when converting the date to a timestamp. As a result, the default site's timezone is used instead, which results in a wrong time if the user's timezone is different than UTC. Thus, the entity does not get published/unpublished at the right time.
Steps to reproduce
- Install and enable the module;
- Add field_scheduled_start and field_scheduled_end to an entity type (in my case it's a taxonomy term) as described in the README.md file (date & time);
- Set your user's time zone to be different than UTC (Berlin in my case)
- Create a new term and set publishing and unpublishing date & time and test. The entity does not get published/unpublished as expected.
Proposed resolution
As the date field has no timezone assigned, it stores the given date & time in UTC. We should pass the UTC timezone explicitly, when getting the timestamps of the scheduling fields' values, otherwise the default site's timezone is used and time doesn't match with the desired one.
I have created a patch for solving the issue on my project and I provide it here.
Remaining tasks
The patch is ready for review.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | proper-scheduling-times-3167394-2.patch | 2.99 KB | marie77e |
Comments
Comment #2
marie77e commentedHere is the patch that I created to fix the scheduling times in different time zones.
Comment #3
marie77e commentedComment #4
adaddinsaneThanks Marie - I knew there was something screwy here but couldn't see what it was.