HEX
Server: Apache/2.4.34 (Red Hat) OpenSSL/1.0.2k-fips
System: Linux WORDPRESS 3.10.0-1160.118.1.el7.x86_64 #1 SMP Thu Apr 4 03:33:23 EDT 2024 x86_64
User: digital (1020)
PHP: 7.2.24
Disabled: NONE
Upload Files
File: /datos/www/fabricas.colombiatrade.com.co/web_https/core/misc/timezone.js
/**
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/

(function ($, Drupal) {
  Drupal.behaviors.setTimezone = {
    attach: function attach(context, settings) {
      var $timezone = $(context).find('.timezone-detect').once('timezone');
      if ($timezone.length) {
        var dateString = Date();

        var matches = dateString.match(/\(([A-Z]{3,5})\)/);
        var abbreviation = matches ? matches[1] : 0;

        var dateNow = new Date();
        var offsetNow = dateNow.getTimezoneOffset() * -60;

        var dateJan = new Date(dateNow.getFullYear(), 0, 1, 12, 0, 0, 0);
        var dateJul = new Date(dateNow.getFullYear(), 6, 1, 12, 0, 0, 0);
        var offsetJan = dateJan.getTimezoneOffset() * -60;
        var offsetJul = dateJul.getTimezoneOffset() * -60;

        var isDaylightSavingTime = void 0;

        if (offsetJan === offsetJul) {
          isDaylightSavingTime = '';
        } else if (Math.max(offsetJan, offsetJul) === offsetNow) {
            isDaylightSavingTime = 1;
          } else {
              isDaylightSavingTime = 0;
            }

        var path = 'system/timezone/' + abbreviation + '/' + offsetNow + '/' + isDaylightSavingTime;
        $.ajax({
          async: false,
          url: Drupal.url(path),
          data: { date: dateString },
          dataType: 'json',
          success: function success(data) {
            if (data) {
              $timezone.val(data);
            }
          }
        });
      }
    }
  };
})(jQuery, Drupal);