Change record status: 
Project: 
Introduced in branch: 
8.8.x
Introduced in version: 
8.8.0-alpha1
Description: 

The function drupal_get_user_timezone() in bootstrap.inc has been replaced with an event listener which updates the default timezone based on site and user configuration. You can now call the builtin PHP function date_default_timezone_get().

The default time zone is set on the following events:

  • A request via KernelEvents::REQUEST
  • When time zone config changes, via ConfigCrudEvent
  • When a user is set via a new AccountSetEvent

The TimeZoneResolver handles these events and uses the same fall back logic:

  1. Use the user-specified timezone, or if not set
  2. Use the site default configured timezone, or if not set
  3. Use the system default timezone

Before:

$timezone = drupal_get_user_timezone()

After:

$timezone = date_default_timezone_get();
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done

Comments

stuchl4n3k’s picture

So I just got stabbed by this. Can someone please explain if there is a reason why cron (e.g. hook_cron()) calls use the fall back (system or 'UTC') and not the configured setting in Drupal?

Edit: sorry, my bad. Was testing this in drush, not the actual cron.