7 lines
310 B
JavaScript
7 lines
310 B
JavaScript
// Returns a new Date moved by `count` weeks (negative counts move backwards).
|
|
// The received date is never mutated and the local time of day is preserved.
|
|
export function shiftWeeks(date, count) {
|
|
const shifted = new Date(date.getTime())
|
|
shifted.setDate(shifted.getDate() + count * 7)
|
|
return shifted
|
|
}
|