Fix wrong unlocked incident level on the last day of month

This commit is contained in:
Bilal Catic
2019-12-06 05:44:18 +01:00
parent fa1fa35986
commit d4f205af1f

View File

@@ -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)){