From d4f205af1f1a176e53578ff7e2d6fd954bab5252 Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Fri, 6 Dec 2019 05:44:18 +0100 Subject: [PATCH] Fix wrong unlocked incident level on the last day of month --- services/integration/doorLockCharges.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/integration/doorLockCharges.js b/services/integration/doorLockCharges.js index 14ee642..1ddeb0f 100644 --- a/services/integration/doorLockCharges.js +++ b/services/integration/doorLockCharges.js @@ -177,8 +177,8 @@ const setUnlockedIncidentsLevel = (incidents) => { formattedIncident.incidentLevel = unlockedIncidentLevelsPrices.UNLOCKED_0.title; formattedIncident.incidentLevelPrice = unlockedIncidentLevelsPrices.UNLOCKED_0.price; } else { - const lastIncidentTime = moment.utc(memberLastIncident.incidentTimestamp).startOf('month'); - const currentIncidentTime = moment.utc(incident.unlockTimestamp).startOf('month'); + const lastIncidentTime = moment.tz(memberLastIncident.incidentTimestamp, UI_TIMEZONE).startOf('month'); + const currentIncidentTime = moment.tz(incident.unlockTimestamp, UI_TIMEZONE).startOf('month'); const timeDiff = Math.abs(lastIncidentTime.diff(currentIncidentTime, 'months')); if (timeDiff >= (parseInt(process.env.UNLOCK_STREAK_REPAIR_AFTER) || 6)){