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 5beb606 commit ef8b120Copy full SHA for ef8b120
components/dashboard/src/components/UsageView.tsx
@@ -41,9 +41,14 @@ function UsageView({ attributionId }: UsageViewProps) {
41
const match = /#(\d{4}-\d{2}-\d{2}):(\d{4}-\d{2}-\d{2})/.exec(location.hash);
42
if (match) {
43
try {
44
- setStartDate(dayjs(match[1], "YYYY-MM-DD"));
45
- setEndDate(dayjs(match[2], "YYYY-MM-DD"));
+ const today = new Date();
+ const prevMonth = new Date(today.getFullYear(), today.getMonth() - 1, today.getDate());
46
+ const todayStr = today.toISOString().slice(0, 10);
47
+ const prevMonthStr = prevMonth.toISOString().slice(0, 10);
48
+ setStartDate(dayjs(prevMonthStr));
49
+ setEndDate(dayjs(todayStr));
50
} catch (e) {
51
+ // Catches the Error
52
console.error(e);
53
}
54
0 commit comments