We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4e0514 commit bf9efa4Copy full SHA for bf9efa4
components/dashboard/src/components/UsageView.tsx
@@ -48,9 +48,14 @@ function UsageView({ attributionId }: UsageViewProps) {
48
const match = /#(\d{4}-\d{2}-\d{2}):(\d{4}-\d{2}-\d{2})/.exec(location.hash);
49
if (match) {
50
try {
51
- setStartDate(dayjs(match[1], "YYYY-MM-DD"));
52
- setEndDate(dayjs(match[2], "YYYY-MM-DD"));
+ const today = new Date();
+ const prevMonth = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate());
53
+ const todayStr = today.toISOString().slice(0, 10);
54
+ const prevMonthStr = prevMonth.toISOString().slice(0, 10);
55
+ setStartDate(dayjs(prevMonthStr));
56
+ setEndDate(dayjs(todayStr));
57
} catch (e) {
58
+ // Catches the Error
59
console.error(e);
60
}
61
0 commit comments