我在以色列,所以我现在的偏移量应该是120. 然而,当我使用 时new Date().getTimezoneOffset(),我回来了-120,所以不仅仅是夏令时问题。我是否应该简单地将每个减号更改为加号,反之亦然?我不知道其他时区的用户可能会遇到什么情况。
这是我的功能:
firebase
.database()
.ref("words/" + newPostKey)
.set({
word,
length: word.length,
time_to_action: timeToAction,
output: output,
lang: project.lang,
country: project.country,
user: userUID,
timestamp : Date.now(),
timezone_offset : new Date().getTimezoneOffset()
});
并且timezone_offset是保存为-120. 我在特拉维夫。