timezoneAbbr.js 547 B

1234567891011121314151617
  1. var timezoneOffset = require('./timezoneOffset');
  2. /**
  3. * Abbreviated time zone name or similar information.
  4. */
  5. function timezoneAbbr(date){
  6. // Date.toString gives different results depending on the
  7. // browser/system so we fallback to timezone offset
  8. // chrome: 'Mon Apr 08 2013 09:02:04 GMT-0300 (BRT)'
  9. // IE: 'Mon Apr 8 09:02:04 UTC-0300 2013'
  10. var tz = /\(([A-Z]{3,4})\)/.exec(date.toString());
  11. return tz? tz[1] : timezoneOffset(date);
  12. }
  13. module.exports = timezoneAbbr;