Fixed date filter.

This commit is contained in:
Mike Cao 2023-07-11 18:23:16 -07:00
parent e7ff083a87
commit 7a5b5cc678
3 changed files with 5 additions and 4 deletions

View File

@ -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}
/>
);
}

View File

@ -33,7 +33,6 @@ export function BaseParameters() {
startDate={startDate}
endDate={endDate}
onChange={handleDateChange}
showAllTime
/>
</FormRow>
</>

View File

@ -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';