How to check if DST (Daylight Saving Time) is in effect, and if so, the offset?

前端 未结 14 1032
栀梦
栀梦 2020-11-22 09:46

This is a bit of my JS code for which this is needed:

var secDiff = Math.abs(Math.round((utc_date-this.premiere_date)/1000));
this.years = this.calculateUnit         


        
14条回答
  •  一向
    一向 (楼主)
    2020-11-22 10:25

    ES6 Style

    Math.min(...[0, 6].map(v => new Date(95, v, 1).getTimezoneOffset() * -1));
    

提交回复
热议问题