Javascript Date.getTimezoneOffset() 在 Node-red 中不工作

Javascript Date.getTimezoneOffset() not working in Node-red

我在 Raspberry Pi 3B 上有 Node-red 运行 Raspbian Stretch。
此输出确认实际设置了 CET 时区:

pi@raspberrypi:~ $ timedatectl
      Local time: Tue 2019-12-10 22:29:51 CET
  Universal time: Tue 2019-12-10 21:29:51 UTC
        RTC time: n/a
       Time zone: Europe/Berlin (CET, +0100)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

我正在尝试计算当前时区 (CET) 与 GMT 时间之间的时区偏移。
为此,我在 node-red 的功能节点中使用了以下行:

msg.payload = new Date().getTimezoneOffset();

但它不是预期的一小时(60 分钟)偏移,而是 returns 0。

根据this and this,需要在settings.js文件(位于$home/.node-red)中为Node-Red明确设置时区:

process.env.TZ = "Europe/Berlin";