Skip to content

Commit

Permalink
common: fix download request for month = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
lowkeynicc committed Dec 16, 2024
1 parent eaca2ae commit 1e97522
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions common-ts/src/utils/s3Buckets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,21 @@ export const getDateRangeFromSelection = (
to = dateToS3DateString(now);
break;
case 'custom':
if (!customOpts || !customOpts?.year) {
if (!customOpts || customOpts?.year == undefined) {
console.error(
'Requested custom date range without providing customOpts'
);
break;
}

if (!customOpts.day && !customOpts.month) {
if (customOpts.day == undefined && customOpts.month == undefined) {
// request a full year
from = dateToS3DateString(new Date(customOpts.year, 0, 1));
to = dateToS3DateString(new Date(customOpts.year, 11, 31));
} else if (!customOpts.day && customOpts.month) {
} else if (
customOpts.day == undefined &&
customOpts.month !== undefined
) {
// request a month
from = dateToS3DateString(
new Date(customOpts.year, customOpts.month, 1)
Expand Down

0 comments on commit 1e97522

Please sign in to comment.