From 1f8e9106de53f3484f67384a0fc0b4e2725859e8 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 27 May 2024 12:19:25 +0100 Subject: [PATCH] Updated the code to set the expiry date to the end of the day --- src/pages/api/paymob/webhook.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/api/paymob/webhook.ts b/src/pages/api/paymob/webhook.ts index a5e7d580..acf2bdf5 100644 --- a/src/pages/api/paymob/webhook.ts +++ b/src/pages/api/paymob/webhook.ts @@ -43,7 +43,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) { const initialDate = moment(subscriptionExpirationDate).isAfter(moment()) ? moment(subscriptionExpirationDate) : moment(); - const updatedSubscriptionExpirationDate = moment(initialDate).add(duration, duration_unit).toISOString(); + const updatedSubscriptionExpirationDate = moment(initialDate).add(duration, duration_unit).endOf("day").toISOString(); await setDoc(userSnapshot.ref, {subscriptionExpirationDate: updatedSubscriptionExpirationDate}, {merge: true}); await setDoc(doc(db, "paypalpayments", v4()), {