After setting the default timezone in a installation profile or after refreshing the configuration page, there should be no timezone detection.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein’s picture

Version: 7.0 » 7.x-dev
Status: Active » Needs review
FileSize
1.23 KB

Yup, that makes sense. And it's basically what system.module already does for the timezone selection on user account pages.

How about this patch?

Jan_vStone’s picture

Seems to fix the issue when you use variable_set('date_default_timezone') but not when using the _form_install_configure_form_alter hook. For that to work, the check if a default timezone has been selected should probably be done in the timezone.js javascript file.

David_Rothstein’s picture

I don't think there's any simple way for the timezone.js code to know who set the form element's default value or what their intention was.

However, we can switch to using #attached to add the JavaScript to the page, so that someone who wants to remove this in hook_form_alter() can do that more easily. That is done in the attached patch.

Jan_vStone’s picture

The solution/patch in #3 works with following code in form_alter (for future reference)

function PROFILE_NAME_form_install_configure_form_alter(&$form, $form_state) {
  $form['server_settings']['date_default_timezone']['#default_value'] = 'Europe/Brussels';

  $key = array_search('misc/timezone.js', $form['server_settings']['date_default_timezone']['#attached']['js']);
  if ($key !== FALSE) {
    unset($form['server_settings']['date_default_timezone']['#attached']['js'][$key]);
  }
}
nod_’s picture

Version: 7.x-dev » 8.x-dev
steinmb’s picture

Time to re-roll patch.

steinmb’s picture

Drupal 7 backport. Tested with hook_form_alter() in a install profile and seemed to work perfect.

Status: Needs review » Needs work

The last submitted patch, install-timezone-detect-1017020-d7-7.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review
cweagans’s picture

tim-e’s picture

Patch for D7.

Status: Needs review » Needs work

The last submitted patch, 1017020-install-timezone-detect.patch, failed testing.

nod_’s picture

Status: Needs work » Needs review

Newt time, please end the name of your current patch with "do-no-test.patch" so that it won't mess up things, thanks :)

tim-e’s picture

oh, is that because this issue is 8.x ?

nod_’s picture

yes :)

steinmb’s picture

@tim-e Why did you remove comments in the D7 patch in #7? Do we not need them?

tim-e’s picture

The patch in #7 didnt work for me since _install_configure_form() reinitialises $form_state['server_settings'] and so we lose the ['#attached'] element and timezone.js is still loaded regardless.

thyssimonis’s picture

If you unset the #attributes the class timezone-detect is removed from the select and no timezone detecting will be run.

This wil work in D7

/**
 * Implements hook_form_FORM_ID_alter().
 */
function PROFILE_NAME_form_install_configure_form_alter(&$form, $form_state) {
  $form['server_settings']['date_default_timezone']['#default_value'] = 'Europe/Amsterdam';
  unset($form['server_settings']['date_default_timezone']['#attributes']);
}

Status: Needs review » Needs work

The last submitted patch, 11: 1017020-install-timezone-detect.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Anyone know whether this is still valid in D9? Anyway needs a issue summary update with a bit more info and steps to reproduce.

longwave’s picture

This looks to still be valid, the core/drupal.timezone library is attached to the site configuration form in the installer whether or not a timezone has already been selected.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.