1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-23 00:16:25 +01:00

fix: convert iso-strings from db to date object

This commit is contained in:
Ivar Conradi Østhus 2021-11-04 22:16:48 +01:00
parent 60cadaf01c
commit 645a8bce05
No known key found for this signature in database
GPG Key ID: 31AC596886B0BD09

View File

@ -22,7 +22,11 @@ import {
IMetricsBucket,
} from '../../types/model';
import { clientRegisterSchema } from './register-schema';
import { minutesToMilliseconds, secondsToMilliseconds } from 'date-fns';
import {
minutesToMilliseconds,
parseISO,
secondsToMilliseconds,
} from 'date-fns';
import TTLList = require('./ttl-list');
export default class ClientMetricsService {
@ -352,8 +356,9 @@ export default class ClientMetricsService {
count += countObj.yes + countObj.no;
});
this.lastHourList.add(toggles, stop);
this.lastMinuteList.add(toggles, stop);
const timestamp = typeof stop === 'string' ? parseISO(stop) : stop;
this.lastHourList.add(toggles, timestamp);
this.lastMinuteList.add(toggles, timestamp);
this.globalCount += count;
// eslint-disable-next-line no-param-reassign