fixed date diff logic

This commit is contained in:
Alex Phillips 2022-04-05 09:13:02 -04:00
parent b8bf957eae
commit 05019e8ea2

View File

@ -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]
}