Skip to content

Commit

Permalink
Det er egentlig torsdagen som avgjør hvilket år og hvilken uke vi er i
Browse files Browse the repository at this point in the history
  • Loading branch information
oddsve committed Oct 15, 2024
1 parent f5472c5 commit 406bac7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
10 changes: 3 additions & 7 deletions frontend/src/hooks/staffing/useSelectedWeek.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ export function useSelectedWeek() {
})
: DateTime.now();

const newDate = date.plus({ week: numberOfWeeks });
let newYear = newDate.year;
if (newDate.month === 12 && newDate.weekNumber === 1 ){
newYear = newDate.year + 1;
}

const newDate = date.plus({ week: numberOfWeeks }).plus({day: 4});

updateFilters({
week: { year: newYear, weekNumber: newDate.weekNumber },
week: { year: newDate.year, weekNumber: newDate.weekNumber },
});
}

Expand Down
10 changes: 3 additions & 7 deletions frontend/src/hooks/useWeekSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ export function useWeekSelectors() {
})
: DateTime.now();

const newDate = date.plus({ week: numberOfWeeks });
let newYear = newDate.year;
if (newDate.month === 12 && newDate.weekNumber === 1 ){
newYear = newDate.year + 1;
}

setSelectedWeek({ year: newYear, weekNumber: newDate.weekNumber });
const newDate = date.plus({ week: numberOfWeeks }).plus({day:4});

setSelectedWeek({ year: newDate.year, weekNumber: newDate.weekNumber });
}

function resetSelectedWeek() {
Expand Down

0 comments on commit 406bac7

Please sign in to comment.