Created
July 2, 2025 15:05
-
-
Save aklump/b1747606ddbedde66b1d4096fb7d6512 to your computer and use it in GitHub Desktop.
Get timezone name per current user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (!$account instanceof \Drupal\Core\Session\AccountInterface || $account->isAnonymous()) { | |
| $timezone_name = \Drupal::config('system.date')->get('timezone.default'); | |
| } | |
| else { | |
| $timezone_name = $account->getTimeZone(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment