Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement drupal_get_user_timezone() #15794

Merged
merged 1 commit into from
Nov 15, 2019
Merged

Implement drupal_get_user_timezone() #15794

merged 1 commit into from
Nov 15, 2019

Conversation

KarinG
Copy link
Contributor

@KarinG KarinG commented Nov 10, 2019

Before

Contributions made by anonymous user were recorded in CiviCRM using timezone set on server level.

Drupal8.php is the only file in /var/www/drupal/vendor/civicrm/civicrm-core/CRM/Utils/System without a public function getTimeZoneString()

After

After implementing drupal_get_user_timezone() -> Contributions made by anonymous users are now recorded in the Default timezone configured within Drupal8:
/admin/config/regional/settings

For testing I added a drupal_set_message(print_r($timezone, TRUE)) in Drupal8.php -> it shows it's correctly finding America/Edmonton.

image

image

image

Technical Details

Similar to the D7 implementation - except simpler. Too simple actually - I could well be missing something though I did some more testing and this seems to work.

Todo: more Testing -> done:

  1. on /admin/config/regional/settings-> change default TimeZone in Drupal to Config to -> Europe/Amsterdam
  2. Anonymous user is now recognized in that timezone (see drupal_set_message left bottom)
    image
  3. And the Contribution in CiviCRM is correctly recorded in that site's default TimeZone - which is indeed +8h ->
    image
  4. Note for all testing above -> php -i |grep timezone -> UTC

@civibot
Copy link

civibot bot commented Nov 10, 2019

(Standard links)

@mlutfy
Copy link
Member

mlutfy commented Nov 15, 2019

Merging based on code review, mattermost discussions and testing on a live site (although admittedly not extensively, but I trust that Karin has).

@mlutfy mlutfy merged commit 57e842c into civicrm:master Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants