Skip to content
Snippets Groups Projects
Commit 3e7b3770 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #1574696 by droplet, nod_: selectors clean-up: timezone.js.

parent a7530e13
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -7,7 +7,8 @@
*/
Drupal.behaviors.setTimezone = {
attach: function (context, settings) {
$(context).find('select.timezone-detect').once('timezone', function () {
var $timezone = $(context).find('.timezone-detect').once('timezone');
if ($timezone.length) {
var dateString = Date();
// In some client environments, date strings include a time zone
// abbreviation, between 3 and 5 letters enclosed in parentheses,
......@@ -49,7 +50,6 @@ Drupal.behaviors.setTimezone = {
// for debugging purposes. Submit a synchronous request to avoid database
// errors associated with concurrent requests during install.
var path = 'system/timezone/' + abbreviation + '/' + offsetNow + '/' + isDaylightSavingTime;
var element = this;
$.ajax({
async: false,
url: Drupal.url(path),
......@@ -57,11 +57,11 @@ Drupal.behaviors.setTimezone = {
dataType: 'json',
success: function (data) {
if (data) {
$(element).val(data);
$timezone.val(data);
}
}
});
});
}
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment