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.

Potential timezone fix

Tim Wilson995a9aa757c8
diff --git a/apps/web/app/api/partner-profile/programs/[programId]/earnings/timeseries/route.ts b/apps/web/app/api/partner-profile/programs/[programId]/earnings/timeseries/route.ts
index e6932d82b6..899897c19b 100644
--- a/apps/web/app/api/partner-profile/programs/[programId]/earnings/timeseries/route.ts
+++ b/apps/web/app/api/partner-profile/programs/[programId]/earnings/timeseries/route.ts
@@ -38,7 +38,7 @@ export const GET = withPartnerProfile(
programId: params.programId,
});
- const { start, end, interval, groupBy, event } =
+ const { start, end, interval, groupBy, event, timezone } =
partnerAnalyticsQuerySchema.parse(searchParams);
const { startDate, endDate, granularity } = getStartEndDates({
@@ -84,7 +84,7 @@ export const GET = withPartnerProfile(
const earnings = await prisma.$queryRaw<Earnings[]>`
SELECT
- DATE_FORMAT(createdAt, ${dateFormat}) AS start,
+ DATE_FORMAT(CONVERT_TZ(createdAt, "UTC", ${timezone || "UTC"}), ${dateFormat}) AS start,
SUM(earnings) AS earnings
FROM Commission
WHERE