From 7bd7688fac9f1c014b3663ba30316141dc18f4c6 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Thu, 24 Aug 2023 10:19:39 -0600 Subject: [PATCH] fix(webapp): use UTC to check if endpoint is outdated --- webapp/src/utils/eosapi.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/webapp/src/utils/eosapi.js b/webapp/src/utils/eosapi.js index 3ffffe29..e772228b 100644 --- a/webapp/src/utils/eosapi.js +++ b/webapp/src/utils/eosapi.js @@ -30,7 +30,11 @@ const callEosApi = async method => { const headBlockTime = response.head_block_time if (headBlockTime) { - const diffBlockTimems = new Date() - new Date(headBlockTime) + const nowUTC = new Date() + + nowUTC.setMinutes(nowUTC.getMinutes() + nowUTC.getTimezoneOffset()) + + const diffBlockTimems = nowUTC - new Date(headBlockTime) if (diffBlockTimems > eosConfig.syncToleranceInterval) { throw new Error(`The endpoint ${eosApi.endpoint} is outdated`)