The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix domain renewal reminder email cron
Steven Teye3cfa5c72be4
diff --git a/apps/web/app/(ee)/api/cron/domains/renewal-reminders/route.ts b/apps/web/app/(ee)/api/cron/domains/renewal-reminders/route.tsindex 2badc86648..30be2adb3b 100644--- a/apps/web/app/(ee)/api/cron/domains/renewal-reminders/route.ts+++ b/apps/web/app/(ee)/api/cron/domains/renewal-reminders/route.ts@@ -6,7 +6,6 @@ import DomainRenewalReminder from "@dub/email/templates/domain-renewal-reminder"import { prisma } from "@dub/prisma";import { chunk, log } from "@dub/utils";import {- addDays,differenceInCalendarDays,endOfDay,formatDistanceStrict,@@ -82,7 +81,9 @@ export async function GET(req: Request) {const reminderDomains = domains.flatMap(({ slug, expiresAt, renewalFee, project }) => {const reminderWindow = differenceInCalendarDays(expiresAt, now);- const chargeAt: Date = addDays(now, reminderWindow);++ // we charge 14 days before the expiration date to ensure timely processing+ const chargeAt: Date = subDays(expiresAt, 14);return project.users.map(({ user }) => ({domain: {@@ -91,7 +92,7 @@ export async function GET(req: Request) {expiresAt,reminderWindow,chargeAt,- chargeInText: formatDistanceStrict(chargeAt, now),+ chargeAtInText: formatDistanceStrict(chargeAt, now),},workspace: {slug: project.slug,diff --git a/packages/email/src/templates/domain-renewal-reminder.tsx b/packages/email/src/templates/domain-renewal-reminder.tsxindex a4c940d2f3..f36fe19a3f 100644--- a/packages/email/src/templates/domain-renewal-reminder.tsx+++ b/packages/email/src/templates/domain-renewal-reminder.tsx@@ -23,9 +23,9 @@ export default function DomainRenewalReminder({slug: "getacme.link",renewalFee: 1200,expiresAt: new Date("2025-08-19"),- chargeAt: new Date("2025-08-16"),reminderWindow: 30,- chargeInText: "2 weeks",+ chargeAt: new Date("2025-08-05"),+ chargeAtInText: "2 weeks",},}: {email: string;@@ -38,7 +38,7 @@ export default function DomainRenewalReminder({renewalFee: number;chargeAt: Date;reminderWindow: number;- chargeInText: string;+ chargeAtInText: string;};}) {return (@@ -70,7 +70,7 @@ export default function DomainRenewalReminder({</span>. We will attempt to charge your card on file{" "}{currencyFormatter(domain.renewalFee / 100)} in{" "}- {domain.chargeInText} on {formatDate(domain.chargeAt)}.+ {domain.chargeAtInText} on {formatDate(domain.chargeAt)}.</Text><Text className="text-sm leading-6 text-neutral-600">