Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

address coderabbit feedback

Steven Teye219ebbf3c40
diff --git a/apps/web/lib/analytics/utils/get-interval-data.ts b/apps/web/lib/analytics/utils/get-interval-data.ts
index dd0aa8be29..47d156edd8 100644
--- a/apps/web/lib/analytics/utils/get-interval-data.ts
+++ b/apps/web/lib/analytics/utils/get-interval-data.ts
@@ -25,44 +25,44 @@ const INTERVAL_DATA: Record<
}),
"7d": ({ timezone }) => ({
startDate: subDays(new TZDate(Date.now(), timezone), 7),
- endDate: endOfToday({ in: tz(timezone ?? "UTC") }),
+ endDate: endOfToday({ in: timezone ? tz(timezone) : undefined }),
granularity: "day",
}),
"30d": ({ timezone }) => ({
startDate: subDays(new TZDate(Date.now(), timezone), 30),
- endDate: endOfToday({ in: tz(timezone ?? "UTC") }),
+ endDate: endOfToday({ in: timezone ? tz(timezone) : undefined }),
granularity: "day",
}),
"90d": ({ timezone }) => ({
startDate: subDays(new TZDate(Date.now(), timezone), 90),
- endDate: endOfToday({ in: tz(timezone ?? "UTC") }),
+ endDate: endOfToday({ in: timezone ? tz(timezone) : undefined }),
granularity: "day",
}),
"1y": ({ timezone }) => ({
startDate: subMonths(new TZDate(Date.now(), timezone), 12),
- endDate: endOfToday({ in: tz(timezone ?? "UTC") }),
+ endDate: endOfToday({ in: timezone ? tz(timezone) : undefined }),
granularity: "month",
}),
mtd: ({ timezone }) => {
return {
startDate: startOfMonth(new TZDate(Date.now(), timezone)),
- endDate: endOfToday({ in: tz(timezone ?? "UTC") }),
+ endDate: endOfToday({ in: timezone ? tz(timezone) : undefined }),
granularity: "day",
};
},
qtd: ({ timezone }) => ({
startDate: startOfQuarter(new TZDate(Date.now(), timezone)),
- endDate: endOfToday({ in: tz(timezone ?? "UTC") }),
+ endDate: endOfToday({ in: timezone ? tz(timezone) : undefined }),
granularity: "day",
}),
ytd: ({ timezone }) => ({
startDate: startOfYear(new TZDate(Date.now(), timezone)),
- endDate: endOfToday({ in: tz(timezone ?? "UTC") }),
+ endDate: endOfToday({ in: timezone ? tz(timezone) : undefined }),
granularity: "month",
}),
all: ({ timezone }) => ({
startDate: new TZDate(DUB_FOUNDING_DATE, timezone),
- endDate: endOfToday({ in: tz(timezone ?? "UTC") }),
+ endDate: endOfToday({ in: timezone ? tz(timezone) : undefined }),
granularity: "month",
}),
};
diff --git a/apps/web/lib/analytics/utils/get-start-end-dates.ts b/apps/web/lib/analytics/utils/get-start-end-dates.ts
index 45fc6ba12a..87c5ff1990 100644
--- a/apps/web/lib/analytics/utils/get-start-end-dates.ts
+++ b/apps/web/lib/analytics/utils/get-start-end-dates.ts
@@ -26,7 +26,7 @@ export const getStartEndDates = ({
endDate = endOfDay(new TZDate(new Date(end ?? Date.now()), timezone));
const daysDifference = differenceInDays(endDate, startDate, {
- in: tz(timezone ?? "UTC"),
+ in: timezone ? tz(timezone) : undefined,
});
if (daysDifference <= 2) {