I'm hoping there is just some setting I'm missing, as this seems like a serious bug, but I'm not seeing others mentioning it, so perhaps there is an easy solve.
I'm finding that the timezone for the site is based on whatever timezone was set for the most recent user updated.
Example 1)
Say it's 12pm in LA and 3pm in NYC.
I have two users. The one I've assigned to New York that I'm testing in Chrome.
The one I've assigned to Los Angeles, I'm testing in Firefox. (I also tested this yesterday with someone who was actually in a different timezone, which is how we discovered it).
My sites Regional Setting is set to UTC (although I also tested with making it NYC).
What happens is, when I update my Chrome/NYC user and clear the sites cache, this Chrome/NYC can now schedule posts for any time after 3pm. That seems fine.
BUT, if I go to my FF/LA user and try to schedule something after 12pm, I get "Error message The 'publish on' date must be in the future.", so I have to add three hours to get it to save and use NYC as my base.
Now, if I simply update my FF/LA user and clear the cache, now the opposite occurs. My FF/LA user can schedule a post for any time after 12, but my Chrome/NYC user can now schedule things up to three hours in their past. They are not both tied to LA time.
The whole time the sites Regional Setting is still UTC.
Example 2)
I update my FF/LA user and clear the site cache.
I can now schedule a post for 12:01.
I go into Chrome, update my NY user and clear the site cache.
I go back to FF, look at the record my FF/LA user just set, and it now says 3:01 pm.
This FF/LA user can’t update this record again to 12:01pm. This site now thinks it’s NY time for the LA user.
So it seems like updating a users individual timezone effects the timezone of all users site.
My concern is that an editor will update their account and all of a sudden, the timezone by which other editors schedule will have changed.
Is this a known issue? Is there a solve for this (aside from disabling users ability to set their own timezones and making them base all schedules upon a site setting)?
Thank you.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3085947-8.timezone-cached.patch | 1.08 KB | jonathan1055 |
Comments
Comment #2
jonathan1055 commentedHi kid_baco,
That is a strange set of observations, and no I've not heard of this before and no one else has reported it. I don't think it can be caused by anyrthing in Scheduler, as from your steps and description Scheduler is only reacting to the state of your site.
Maybe it is worth you repeating the steps but at key places check what you see at /admin/reports/status for the 'Scheduler time check' section. That will show the current state of all the time settings.
Secondly, do you have the means to create a clen fresh drupal8 site and enable only Scheduler then repeat the process. It may be another module is interferring with the site timezone setting.
Jonathan
Comment #3
kid_baco commentedHi Jonathan,
Thanks for your reply. Given how popular this module is and that you haven't heard this before makes me think it's something solvable on my end.
That said, I have added the scheduler module to a different drupal install (not completely clean, but pretty bare) and done the same kind of testing, to find the same results.
Also, when I go to /admin/reports/scheduler in FF(LA), I see
Server time: 8th October 2019, 15:16:15 +00:00
Local time: 8th October 2019, 08:16:15 -07:00 PDT America/Los_Angeles (currently in daylight saving mode).
And if I go to Chrome, I see
Server time: 8th October 2019, 15:16:40 +00:00
Local time: 8th October 2019, 11:16:40 -04:00 EDT America/New_York (currently in daylight saving mode).
Does anything in these results setoff a red flag for you?
I'm rather baffled and hoping there is just some small step or setting I'm missing.
Comment #4
partdigital commentedI want to chime in and say that I'm also reporting seeing a similar issue. I was able to reproduce it on a clean install of Drupal the only contrib module installed is Scheduler 8.x-1.1.
It saves the timestamp based on a user's timezone during the last cache clear. The problem therein lies when multiple users from different Timezones are scheduling content.
Chicago user creates a node to be published Oct 31, 2019 at 9:00 AM
- Saves timestamp 1572530400
UTC user creates a node to be published Oct 31, 2019 at 9:00 AM
- Saves timestamp 1572530400 (uses the Chicago Timezone)
- Cache is cleared
Chicago user creates a node to be published Oct 31, 2019 at 9:00 AM
- Saves timestamp 1572512400 (uses the UTC Timezone)
So scheduling form inherits the timezone of whatever user is viewing the node edit form after a cache clear.
Comment #5
partdigital commentedI spent some more time digging into this and it looks like it may be a Drupal Core issue. It reproduces the same behavior for the "Authored On" field.
I’ve opened a Core ticket: https://www.drupal.org/project/drupal/issues/3087606
Because this is a Drupal core issue it should be addressed there, however, I understand we can’t always wait for a core update so I’ve created a small patch which addresses the issue for this context.
Comment #6
jonathan1055 commentedThank you @partdigital that is really helpful. I really thought it could not be caused by Scheduler. Also I wonder if core behaviour has changed recently, as this problem should have been discovered before if it has been in Core for a while. I'll follow #3087606: Datetime::getInfo() caches user's timezone causing unpredictable timestamps. and see how it goes. Good that we have a patch here for anyone who is experienceing this problem.
@kid_baco can you try the patch in #5 and let us know how you get on.
Thanks
Comment #7
jonathan1055 commentedAll the test failures are due to deprecation messages
https://www.drupal.org/node/3009387 is the change record. It may be that we have to check the core version in code and use either
drupal_get_user_timezone()ordate_default_timezone_get(). We need Scheduler tests to pass at 8.6, 8.7 and 8.8Comment #8
jonathan1055 commentedThe commit to core which causes this problem was on 20 Nov 2018 so it exists right from the start of 8.7.0. I have sucessfully re-created the problem, in both core 8.7 and 8.8. My steps are slightly different so I have listed them here:
As you correctly deduced, the timezone has been taken from UTC user because cache was not cleared. Consequently the scheduled time is 5 hours earlier than the user wanted.
Here is a patch using the built-in
date_default_timezone_get()which fixes the problem locally on 8.7 and 8.8. This patch should pass on 8.7 and 8.8 as this function is not deprecated.Comment #9
jonathan1055 commentedGood news - #3087606: Datetime::getInfo() caches user's timezone causing unpredictable timestamps. has been fixed and committed to core 8.9 and 8.8, but unfortunately it has not been backported to 8.7.
If anyone following this thread needs it, let me know if patch #8 fixes your core 8.7 site and then I could commit this, with a @todo to remove it when core 8.8 become the lowest version we support.
Comment #10
jonathan1055 commentedThank you kid_baco and partdigital for your help here.
It's gone two weeks without any response, so closing this as fixed. If anyone needs the correction for core 8.7 and cannot apply the patch in #8 then please re-open this issue and we can discuss a solution.