comparison core/misc/timezone.es6.js @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 /** 1 /**
2 * @file 2 * @file
3 * Timezone detection. 3 * Timezone detection.
4 */ 4 */
5 5
6 (function ($, Drupal) { 6 (function($, Drupal) {
7 /** 7 /**
8 * Set the client's system time zone as default values of form fields. 8 * Set the client's system time zone as default values of form fields.
9 * 9 *
10 * @type {Drupal~behavior} 10 * @type {Drupal~behavior}
11 */ 11 */
12 Drupal.behaviors.setTimezone = { 12 Drupal.behaviors.setTimezone = {
13 attach(context, settings) { 13 attach(context, settings) {
14 const $timezone = $(context).find('.timezone-detect').once('timezone'); 14 const $timezone = $(context)
15 .find('.timezone-detect')
16 .once('timezone');
15 if ($timezone.length) { 17 if ($timezone.length) {
16 const dateString = Date(); 18 const dateString = Date();
17 // In some client environments, date strings include a time zone 19 // In some client environments, date strings include a time zone
18 // abbreviation, between 3 and 5 letters enclosed in parentheses, 20 // abbreviation, between 3 and 5 letters enclosed in parentheses,
19 // which can be interpreted by PHP. 21 // which can be interpreted by PHP.
67 }, 69 },
68 }); 70 });
69 } 71 }
70 }, 72 },
71 }; 73 };
72 }(jQuery, Drupal)); 74 })(jQuery, Drupal);