【发布时间】:2020-08-19 18:03:42
【问题描述】:
下面的代码不适用于 Firefox,但在 Chrome 上运行良好。有人可以帮我找到替代解决方案吗?
const tempDate = getStartDate['startDate']; // Returns: 2020-08-13 12:52:38
new Date(`${tempDate} UTC`);
Expected Output: Thu Aug 13 2020 08:52:38 GMT-0400 (Eastern Daylight Time)
【问题讨论】:
-
你在里面有
GMT-0400和UTC,是哪一个?new Date(`Wed Aug 12 2020 18:34:35 GMT-0400`);按预期工作。
标签: javascript datetime timezone utc