Skip to content

Commit e64cd5e

Browse files
committed
Fix usage page for previous months
1 parent 56060d3 commit e64cd5e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

apps/webapp/app/presenters/v3/UsagePresenter.server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export type UsageSeriesData = {
2727

2828
export class UsagePresenter extends BasePresenter {
2929
public async call({ organizationId, startDate }: Options) {
30+
if (isNaN(startDate.getTime())) {
31+
throw new Error("Invalid start date");
32+
}
33+
3034
//month period
3135
const startOfMonth = new Date(startDate);
3236
startOfMonth.setUTCDate(1);

apps/webapp/app/routes/_app.orgs.$organizationSlug.v3.usage/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
6666

6767
const search = new URL(request.url).searchParams;
6868
const searchMonth = search.get("month");
69-
const startDate = searchMonth ? new Date(searchMonth) : months[0];
69+
const startDate = searchMonth ? new Date(decodeURIComponent(searchMonth)) : months[0];
7070
startDate.setUTCDate(1);
7171
startDate.setUTCHours(0, 0, 0, 0);
7272

0 commit comments

Comments
 (0)