Skip to content

Commit

Permalink
Merge pull request #2684 from michael-genson/fix/mealplan-date-off-by…
Browse files Browse the repository at this point in the history
…-one

fix: Mealplanner Date Off By One (Daylight Savings)
  • Loading branch information
boc-the-git authored Oct 27, 2023
2 parents 603a0c0 + 8379661 commit 4ec7bd4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions frontend/pages/group/mealplan/planner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export default defineComponent({
});
if (sorted.length === 2) {
console.log(parseYYYYMMDD(sorted[0]));
return {
start: parseYYYYMMDD(sorted[0]),
end: parseYYYYMMDD(sorted[1]),
Expand All @@ -105,11 +104,15 @@ export default defineComponent({
const numDays =
Math.floor((weekRange.value.end.getTime() - weekRange.value.start.getTime()) / (1000 * 60 * 60 * 24)) + 1;
// Calculate aboslute value
// Calculate absolute value
if (numDays < 0) return [];
return Array.from(Array(numDays).keys()).map(
(i) => new Date(weekRange.value.start.getTime() + i * 24 * 60 * 60 * 1000)
(i) => {
const date = new Date(weekRange.value.start.getTime());
date.setDate(date.getDate() + i);
return date;
}
);
});
Expand Down

0 comments on commit 4ec7bd4

Please sign in to comment.