mealplandialog date range working and moving

This commit is contained in:
vabene1111
2024-07-20 10:02:32 +02:00
parent 71e5e32206
commit 11b42470b6
2 changed files with 40 additions and 9 deletions

View File

@@ -0,0 +1,14 @@
import {DateTime} from "luxon";
/**
* shifts a range of dates/any array of dates by the number of days given in the day modifier (can be positive or negative)
* @param dateRange
* @param dayModifier
*/
export function shiftDateRange(dateRange: Date[], dayModifier: number){
let newDateRange: Date[] = []
dateRange.forEach(date => {
newDateRange.push(DateTime.fromJSDate(date).plus({'days': dayModifier}).toJSDate())
})
return newDateRange
}