From 7a5b5cc67871238085d5fe355bd27ec12cbbffe3 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 11 Jul 2023 18:23:16 -0700 Subject: [PATCH] Fixed date filter. --- components/input/WebsiteDateFilter.js | 5 ++++- components/pages/reports/BaseParameters.js | 1 - components/pages/websites/WebsiteMetricsBar.js | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/input/WebsiteDateFilter.js b/components/input/WebsiteDateFilter.js index 88f4bd85..91721974 100644 --- a/components/input/WebsiteDateFilter.js +++ b/components/input/WebsiteDateFilter.js @@ -13,7 +13,9 @@ export default function WebsiteDateFilter({ websiteId }) { const data = await get(`/websites/${websiteId}`); if (data) { - setDateRange(`range:${new Date(data.createdAt)}:${Date.now()}`); + const start = new Date(data.createdAt).getTime(); + const end = Date.now(); + setDateRange(`range:${start}:${end}`); } } else if (value !== 'all') { setDateRange(value); @@ -27,6 +29,7 @@ export default function WebsiteDateFilter({ websiteId }) { startDate={startDate} endDate={endDate} onChange={handleChange} + showAllTime={true} /> ); } diff --git a/components/pages/reports/BaseParameters.js b/components/pages/reports/BaseParameters.js index 5dbe0f60..394432cf 100644 --- a/components/pages/reports/BaseParameters.js +++ b/components/pages/reports/BaseParameters.js @@ -33,7 +33,6 @@ export function BaseParameters() { startDate={startDate} endDate={endDate} onChange={handleDateChange} - showAllTime /> diff --git a/components/pages/websites/WebsiteMetricsBar.js b/components/pages/websites/WebsiteMetricsBar.js index 12cab24b..3683310c 100644 --- a/components/pages/websites/WebsiteMetricsBar.js +++ b/components/pages/websites/WebsiteMetricsBar.js @@ -1,7 +1,6 @@ -import { useState } from 'react'; import classNames from 'classnames'; import { Row, Column } from 'react-basics'; -import { formatShortTime, formatNumber, formatLongNumber } from 'lib/format'; +import { formatShortTime } from 'lib/format'; import MetricCard from 'components/metrics/MetricCard'; import RefreshButton from 'components/input/RefreshButton'; import WebsiteDateFilter from 'components/input/WebsiteDateFilter';