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.

min date-fns

Pedro Ladeira9732b69c8cd5
diff --git a/apps/web/app/(ee)/api/events/export/route.ts b/apps/web/app/(ee)/api/events/export/route.ts
index 9e999f6b89..f6ae3eb324 100644
--- a/apps/web/app/(ee)/api/events/export/route.ts
+++ b/apps/web/app/(ee)/api/events/export/route.ts
@@ -18,6 +18,7 @@ import { qstash } from "@/lib/cron";
import { verifyFolderAccess } from "@/lib/folder/permissions";
import { eventsQuerySchema } from "@/lib/zod/schemas/analytics";
import { APP_DOMAIN_WITH_NGROK, capitalize } from "@dub/utils";
+import { min } from "date-fns";
import { NextResponse } from "next/server";
import * as z from "zod/v4";
@@ -69,10 +70,10 @@ export const GET = withWorkspace(
programStartedAt = program.startedAt;
}
- const dataAvailableFrom =
- programStartedAt && programStartedAt < workspace.createdAt
- ? programStartedAt
- : workspace.createdAt;
+ const dataAvailableFrom = min([
+ workspace.createdAt,
+ ...(programStartedAt ? [programStartedAt] : []),
+ ]);
let folderIdToVerify = getFirstFilterValue(folderId);
if (!linkId && (externalId || (domain && key))) {