From ea1c3ea8c792a452ab11b110b0bf88fadd9ff7c2 Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Sun, 26 Oct 2025 18:35:41 +0530 Subject: [PATCH] extracted to local variable instead of iife --- src/lib/stores/billing.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index fbbd83072..46134dde3 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -488,6 +488,9 @@ export async function paymentExpired(org: Organization) { const nots = get(notifications); const expiredNotification = nots.some((n) => n.message === expiredMessage); const expiringNotification = nots.some((n) => n.message === expiringMessage); + const cardExpiry = new Date(payment.expiryYear, payment.expiryMonth, 1); + const nextMonth = new Date(year, month + 1, 1); + const isExpiringNextMonth = cardExpiry.getTime() === nextMonth.getTime(); if (payment.expired && !expiredNotification) { addNotification({ type: 'error', @@ -503,15 +506,7 @@ export async function paymentExpired(org: Organization) { } ] }); - } else if ( - !expiringNotification && - !payment.expired && - (() => { - const cardExpiry = new Date(payment.expiryYear, payment.expiryMonth, 1); - const nextMonth = new Date(year, month + 1, 1); - return cardExpiry.getTime() === nextMonth.getTime(); - })() - ) { + } else if (!expiringNotification && !payment.expired && isExpiringNextMonth) { addNotification({ type: 'warning', isHtml: true,