Merge branch 'dev' into analytics

This commit is contained in:
Mike Cao 2024-03-21 08:51:33 -07:00
commit 1de3ae4526
2 changed files with 6 additions and 6 deletions

View File

@ -111,7 +111,7 @@ export function Chart({
} else {
const { index } = item;
const meta = chart.current.getDatasetMeta(0);
const hidden = !!meta.data[index].hidden;
const hidden = !!meta?.data?.[index]?.hidden;
meta.data[index].hidden = !hidden;
chart.current.legend.legendItems[index].hidden = !hidden;

View File

@ -164,7 +164,7 @@ export function parseDateRange(value: string | object, locale = 'en-US'): DateRa
case 'day':
return {
startDate: subDays(startOfDay(now), num),
endDate: endOfDay(now),
endDate: subDays(endOfDay(now), num ? 1 : 0),
unit: num ? 'day' : 'hour',
offset: 0,
num: num || 1,
@ -181,8 +181,8 @@ export function parseDateRange(value: string | object, locale = 'en-US'): DateRa
};
case 'month':
return {
startDate: subMonths(startOfMonth(now), 1),
endDate: subMonths(endOfMonth(now), 1),
startDate: subMonths(startOfMonth(now), num),
endDate: subMonths(endOfMonth(now), num),
unit: 'day',
offset: 0,
num: num || 1,
@ -190,8 +190,8 @@ export function parseDateRange(value: string | object, locale = 'en-US'): DateRa
};
case 'year':
return {
startDate: subYears(startOfYear(now), 1),
endDate: subYears(endOfYear(now), 1),
startDate: subYears(startOfYear(now), num),
endDate: subYears(endOfYear(now), num),
unit: 'month',
offset: 0,
num: num || 1,