如何获取实际时差(又名时区偏移量)?

时间:2018-08-23 14:09:51

标签: typescript date moment-timezone

我正在使用moment-timezone lib。我的问题是,在计算偏移量时,它似乎并不关心夏时制偏移。 示例:

//This date is in August when Warsaw is +2 vs UTC
const w = momentTz.tz([2018, 7, 31, 12, 15, 45, 500], 'Europe/Warsaw');
const timestamp = w.unix();
const offset= momentTz.tz.zone('Europe/Warsaw').utcOffset(timestamp);

//Prints '-60', while the real offset is '-120'
console.log(offset);

0 个答案:

没有答案