Free & Open-Source Invoice Generator - No Sign-Up, No Ads, Instant PDF Export, 100% In-Browser, and Fully Customizable Templates.
TypeScript fintechinvoiceinvoice-generatorinvoice-pdfinvoice-templateinvoicesnextjsopen-sourcequotesreactreact-pdf-rendererself-hostedshadcn-uitailwindcsstypescript
fix: update invoice generation hour to 15:00 Warsaw time and adjust related tests
VladSez9767d8f288f0
diff --git a/src/trigger/__tests__/monthly-recurring-invoice.test.ts b/src/trigger/__tests__/monthly-recurring-invoice.test.tsindex ed6a673..654aa53 100644--- a/src/trigger/__tests__/monthly-recurring-invoice.test.ts+++ b/src/trigger/__tests__/monthly-recurring-invoice.test.ts@@ -45,9 +45,9 @@ const SATURDAY_JAN_10_2026 = new Date("2026-01-10T12:00:00Z");const SUNDAY_MAY_10_2026 = new Date("2026-05-10T11:00:00Z");const FRIDAY_JUL_10_2026 = new Date("2026-07-10T11:00:00Z");-// Resume-at instants: 15:00 Warsaw on the following Monday (matches INVOICE_GENERATION_HOUR).-const MONDAY_JAN_12_2026_15_WARSAW = new Date("2026-01-12T14:00:00.000Z");-const MONDAY_MAY_11_2026_15_WARSAW = new Date("2026-05-11T13:00:00.000Z");+// Resume-at instants: 13:00 Warsaw on the following Monday (matches INVOICE_GENERATION_HOUR).+const MONDAY_JAN_12_2026_13_WARSAW = new Date("2026-01-12T12:00:00.000Z");+const MONDAY_MAY_11_2026_13_WARSAW = new Date("2026-05-11T11:00:00.000Z");function createPayload(timestamp: Date): ScheduledTaskPayload {return {@@ -130,13 +130,13 @@ describe("monthlyRecurringInvoice", () => {await runMonthlyRecurringInvoice!(createPayload(SATURDAY_JAN_10_2026));expect(mockWaitUntil).toHaveBeenCalledWith({- date: MONDAY_JAN_12_2026_15_WARSAW,+ date: MONDAY_JAN_12_2026_13_WARSAW,});expect(mockLoggerLog).toHaveBeenCalledWith("The 10th falls on a weekend, waiting until Monday to generate the invoice",{scheduledAt: SATURDAY_JAN_10_2026,- resumeAt: MONDAY_JAN_12_2026_15_WARSAW,+ resumeAt: MONDAY_JAN_12_2026_13_WARSAW,},);expect(fetch).toHaveBeenCalledOnce();@@ -146,7 +146,7 @@ describe("monthlyRecurringInvoice", () => {await runMonthlyRecurringInvoice!(createPayload(SUNDAY_MAY_10_2026));expect(mockWaitUntil).toHaveBeenCalledWith({- date: MONDAY_MAY_11_2026_15_WARSAW,+ date: MONDAY_MAY_11_2026_13_WARSAW,});expect(fetch).toHaveBeenCalledOnce();});diff --git a/src/trigger/monthly-recurring-invoice.ts b/src/trigger/monthly-recurring-invoice.tsindex 00c1ced..d81e1b7 100644--- a/src/trigger/monthly-recurring-invoice.ts+++ b/src/trigger/monthly-recurring-invoice.ts@@ -11,7 +11,7 @@ const APP_URL = process.env.APP_URL ?? `http://localhost:3000`;const INVOICE_API_URL = `${APP_URL}/api/generate-invoice` as const;// Hour of the day (Warsaw wall time) at which the invoice is generated.-const INVOICE_GENERATION_HOUR = 15;+const INVOICE_GENERATION_HOUR = 13;/*** Generates the monthly recurring invoice on the 10th of every month@@ -31,7 +31,7 @@ export const monthlyRecurringInvoice = schedules.task({},cron: {// 15:00 on the 10th of every month, Warsaw wall time (DST-adjusted automatically)- pattern: `0 ${INVOICE_GENERATION_HOUR} 27 * *`, // IMPORTANT: we use the 27th only for TESTING. RETURN BACK TO 10TH AFTER TESTING!!!+ pattern: `0 ${INVOICE_GENERATION_HOUR} 10 * *`,timezone: WARSAW_TIME_ZONE,environments: ["PRODUCTION"],},