Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
achanda authored and rozenmd committed Jun 11, 2024
1 parent aa10cdc commit 290f382
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/wrangler/src/d1/insights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,19 @@ function getDurationDates(durationString: string) {
);
break;
case "m":
if (durationValue > 31 * 24 * 60) {
throw new Error(
`Duration cannot be greater than ${31 * 24 * 60} minutes (31 days)`
);
}
startDate = new Date(endDate.getTime() - durationValue * 60 * 1000);
break;
case "h":
if (durationValue > 31 * 24) {
throw new Error(
`Duration cannot be greater than ${31 * 24} hours (31 days)`
);
}
startDate = new Date(endDate.getTime() - durationValue * 60 * 60 * 1000);
break;
default:
Expand Down

0 comments on commit 290f382

Please sign in to comment.