From 631d838834abc456003fb6322c3d4f81822a917a Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski Date: Mon, 6 Apr 2026 23:38:55 +0200 Subject: [PATCH] Fix recurring invoices using wrong date in non-UTC timezones Pass the app's configured timezone to CronExpression::getNextRunDate() so the next invoice date is calculated in the correct timezone instead of defaulting to UTC. Fixes #491 --- app/Models/RecurringInvoice.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index a42ed365..39b19b20 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -201,8 +201,9 @@ class RecurringInvoice extends Model public static function getNextInvoiceDate(string $frequency, string $starts_at): string { $cron = new Cron\CronExpression($frequency); + $timezone = config('app.timezone', 'UTC'); - return $cron->getNextRunDate($starts_at)->format('Y-m-d H:i:s'); + return $cron->getNextRunDate($starts_at, 0, false, $timezone)->format('Y-m-d H:i:s'); } public function updateNextInvoiceDate(): void