fix: Consider timezone in the reports (#4027)

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Pranav Raj S
2022-02-28 10:56:24 +05:30
committed by GitHub
parent 4ca66c1195
commit 9b615f11f1
7 changed files with 73 additions and 46 deletions

View File

@@ -1,9 +1,6 @@
/* eslint no-console: 0 */
/* eslint no-param-reassign: 0 */
/* eslint no-shadow: 0 */
import compareAsc from 'date-fns/compareAsc';
import fromUnixTime from 'date-fns/fromUnixTime';
import * as types from '../mutation-types';
import Report from '../../api/reports';
@@ -48,7 +45,8 @@ export const actions = {
).then(accountReport => {
let { data } = accountReport;
data = data.filter(
el => compareAsc(new Date(), fromUnixTime(el.timestamp)) > -1
el =>
reportObj.to - el.timestamp > 0 && el.timestamp - reportObj.from >= 0
);
if (
reportObj.metric === 'avg_first_response_time' ||