问题
I am using moment timezone library to show the zone abbreviation after the timestamp. I am using the following snippet to show the zone abbreviation of New York, USA
var timeZone = moment.tz.guess();
const zoneName = moment.tz(timeZone).zoneName();
return moment().tz("America/New_York").zoneName();
This returns me the Zone abbreviation EDT. My question is: when winter will come will it automatically return EST?
回答1:
Yes, it will.
var jun = moment("2014-06-01T12:00:00Z");
var dec = moment("2014-12-01T12:00:00Z");
jun.tz('America/New_York').format('ha z'); // 8am EDT
dec.tz('America/New_York').format('ha z'); // 7am EST
Source
来源:https://stackoverflow.com/questions/62798753/is-zone-abbreviation-using-moment-zone-library-a-dynamic