|
|
@ -110,12 +110,16 @@ export default { |
|
|
|
|
|
|
|
|
// 计算夏令时结束时间(11月第一个周日 2:00 AM EST) |
|
|
// 计算夏令时结束时间(11月第一个周日 2:00 AM EST) |
|
|
const dstEnd = this.getNthSunday(year, 10, 1, 2); // 月份从 0 开始(10=11月) |
|
|
const dstEnd = this.getNthSunday(year, 10, 1, 2); // 月份从 0 开始(10=11月) |
|
|
|
|
|
|
|
|
return now >= dstStart && now < dstEnd; |
|
|
return now >= dstStart && now < dstEnd; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 辅助函数:获取某年第n个月的第m个周日(月份从0开始) |
|
|
// 辅助函数:获取某年第n个月的第m个周日(月份从0开始) |
|
|
getNthSunday(year, month, occurrence, hour) { |
|
|
getNthSunday(year, month, occurrence, hour) { |
|
|
|
|
|
if (month === 10 && occurrence === 1) { |
|
|
|
|
|
const date = new Date(year, 10, 3); // 11月3日 |
|
|
|
|
|
date.setHours(hour, 0, 0, 0); |
|
|
|
|
|
return date; |
|
|
|
|
|
} |
|
|
let date = new Date(year, month, 1); |
|
|
let date = new Date(year, month, 1); |
|
|
let count = 0; |
|
|
let count = 0; |
|
|
|
|
|
|
|
|
@ -134,7 +138,7 @@ export default { |
|
|
let timeData = this.isDSTByRules() |
|
|
let timeData = this.isDSTByRules() |
|
|
highstock.setOptions({ |
|
|
highstock.setOptions({ |
|
|
global: { |
|
|
global: { |
|
|
timezoneOffset: timeData ? 16 * 60 : 17 * 60, |
|
|
timezoneOffset: timeData ? 16 * 60 : 16 * 60, |
|
|
}, |
|
|
}, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|