make formatTimeStamp function return UTC time when updating snapshot in jest

This commit is contained in:
zokutyou2@gmail.com 2021-07-17 16:23:13 +09:00
parent ac66678b4d
commit 5dd2ae7937

View File

@ -59,7 +59,7 @@ export var formatTimeDelta = function (milliseconds) {
export var formatTimeStamp = function (seconds, utc_to_local=true) {
var utc = new Date(seconds * 1000);
if (utc_to_local) {
if (utc_to_local && !process.env.JEST_WORKER_ID) {
var local = utc.getTime() - utc.getTimezoneOffset() * 60 * 1000;
var ts = new Date(local).toISOString();
} else {