From a64096afc27121b8c3a0e82462a112237f314a92 Mon Sep 17 00:00:00 2001 From: Ricky Raup Date: Fri, 17 May 2024 19:38:28 -0400 Subject: [PATCH] fix time last --- server/src/services/mail.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/services/mail.service.ts b/server/src/services/mail.service.ts index c32a3401..0a207437 100644 --- a/server/src/services/mail.service.ts +++ b/server/src/services/mail.service.ts @@ -102,7 +102,7 @@ const parseArray = (array: any) => { }; const formatOrderToEmail = (order: IOrder) => { - const pickupDate = new Date(order.pickup); + let pickupDate = new Date(order.pickup); if (order.advanced) { return ( `
Organization: ${order.organization}
` + @@ -120,6 +120,11 @@ const formatOrderToEmail = (order: IOrder) => { })}` ); } + const adjustDateByHours = (date: Date, hoursToSubtract: number): Date => { + date.setHours(date.getHours() - hoursToSubtract); + return date; + }; + pickupDate = adjustDateByHours(pickupDate, 4); return ( `
Organization: ${order.organization}
` + `
Produce: ${order.produce}
` +