I need a way to detect the timezone of a given date object. I do NOT want the offset, nor do I want the full timezone name. I need to get the timezone abbreviation.
try { result = /.*\s(.+)/.exec(date.toLocaleDateString(navigator.language, {timeZoneName:'short' }))[1]; } catch(e) { result = (new Date()).toTimeString().match(new RegExp("[A-Z](?!.*[\(])","g")).join(''); } console.log(result);