mirror of
https://github.com/linuxserver/budge.git
synced 2026-03-09 00:08:38 +08:00
fixed date diff logic
This commit is contained in:
parent
b8bf957eae
commit
05019e8ea2
@ -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]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user