Skip to content

Commit

Permalink
fix: wrong yesterday range
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
  • Loading branch information
explodingcamera committed Sep 25, 2024
1 parent e48d19c commit 76278b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions web/src/api/ranges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ export const ranges: Record<RangeName, () => { range: DateRange; dataPoints: num
return { range: { start, end }, dataPoints: hours + 1, graphRange: "hour" };
},
yesterday: () => {
const end = startOfDay(new Date());
const start = subDays(end, 1);
return { range: { start: start.getTime(), end: addHours(end, 1).getTime() }, dataPoints: 25, graphRange: "hour" };
const now = new Date();
const start = addHours(startOfDay(subDays(now, 1)), 1).getTime();
const end = addHours(endOfDay(subDays(now, 1)), 1).getTime();
return { range: { start: start, end }, dataPoints: 24, graphRange: "hour" };
},
last7Days: () => ({ range: lastXDays(7), dataPoints: 7, graphRange: "day" }),
last30Days: () => ({ range: lastXDays(30), dataPoints: 30, graphRange: "day" }),
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/p/[...project].astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const getStaticPaths = (() => {
{ params: { project: "project" } },
{ params: { project: "private-project" } },
{ params: { project: "public-project" } },
{ params: { project: "liwan.dev" } },
];
}) satisfies GetStaticPaths;
---
Expand Down

0 comments on commit 76278b5

Please sign in to comment.