Merge pull request #230 from ArtemKolodko/refactor_chart_filter

Change month filter
pull/232/head
Artem 2 years ago committed by GitHub
commit 9a1aea7b0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/pages/ChartsPage/DailyChartPage.tsx

@ -67,8 +67,8 @@ const chartItemFilter = (item: MetricsDailyItem, option: ChartOption) => {
const date = dayjs(item.date)
const current = dayjs()
switch(option) {
case ChartOption.month: return current.diff(date, 'month') <= 1
case ChartOption.month3: return current.diff(date, 'month') <= 3
case ChartOption.month: return current.diff(date, 'month') < 1
case ChartOption.month3: return current.diff(date, 'month') < 3
case ChartOption.year: return current.diff(date, 'month') <= 12
case ChartOption.ytd: return current.year() === date.year()
default:
@ -184,9 +184,10 @@ export const DailyChartPage = (props: DailyChartPageProps) => {
</Box>
<Box margin={{ top: '32px' }} align={'end'}>
<Box direction={'row'} gap={'4px'}>
<Text>Download</Text>
<Text size={'small'}>Download</Text>
<TextLink
color={'brand'}
size={'small'}
onClick={() => downloadMetricsCSV(`${props.unitLabel}_metrics.csv`, { items: [...cache].reverse() })}>
CSV Data
</TextLink>

Loading…
Cancel
Save