DefaultTimeZone.js 535 B

123456789101112131415161718
  1. 'use strict';
  2. var callBind = require('call-bind');
  3. var I402 = typeof Intl === 'undefined' ? null : Intl;
  4. var DateTimeFormat = I402 && I402.DateTimeFormat;
  5. var resolvedOptions = DateTimeFormat && callBind(DateTimeFormat.prototype.resolvedOptions);
  6. // https://262.ecma-international.org/14.0/#sec-defaulttimezone
  7. // https://tc39.es/ecma402/2023/#sup-defaulttimezone
  8. module.exports = function DefaultTimeZone() {
  9. if (DateTimeFormat && resolvedOptions) {
  10. return resolvedOptions(new DateTimeFormat()).timeZone;
  11. }
  12. return 'UTC';
  13. };