From 05019e8ea2cc9bf82a6bb66f36f8f88db8769c99 Mon Sep 17 00:00:00 2001 From: Alex Phillips Date: Tue, 5 Apr 2022 09:13:02 -0400 Subject: [PATCH] fixed date diff logic --- backend/src/utils.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/backend/src/utils.ts b/backend/src/utils.ts index 9bbdee5..5c2586b 100644 --- a/backend/src/utils.ts +++ b/backend/src/utils.ts @@ -31,13 +31,7 @@ export function getMonthString(): string { export function getMonthStringFromNow(monthsAway: number): string { let today: DateTime = DateTime.now() - today = today.set({ day: 1 }) - - if (monthsAway > 0) { - today = today.plus({ month: monthsAway }) - } else { - today = today.minus({ month: monthsAway }) - } + today = today.set({ day: 1 }).plus({ month: monthsAway }) return today.toISO().split('T')[0] }