Skip to content

Commit

Permalink
Merge pull request #2794 from TyreceDJ/mobileCalender/sort
Browse files Browse the repository at this point in the history
Sorted by current day in meal plan
  • Loading branch information
vabene1111 authored Dec 16, 2023
2 parents 1d84e78 + 0e34cc7 commit 1635a3a
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions vue/src/apps/MealPlanView/MealPlanView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -363,20 +363,26 @@ export default {
}
},
mobileSimpleGrid() {
let grid = []
if (this.current_period !== null) {
for (const x of Array(7).keys()) {
let moment_date = moment(this.current_period.periodStart).add(x, "d")
grid.push({
date: moment_date,
create_default_date: moment_date.format("YYYY-MM-DD"), // improve meal plan edit modal to do formatting itself and accept dates
date_label: moment_date.format("dd") + " " + moment_date.format("ll"),
plan_entries: this.plan_items.filter((m) => moment_date.isBetween(moment(m.startDate), moment(m.endDate), 'day', '[]'))
})
}
let grid = [];
let currentDate = moment();
for (let x = 0; x < 7; x++) {
let moment_date = currentDate.clone().add(x, "d");
grid.push({
date: moment_date,
create_default_date: moment_date.format("YYYY-MM-DD"),
date_label: moment_date.format("dd") + " " + moment_date.format("ll"),
plan_entries: this.plan_items.filter(
(m) =>
moment_date.isBetween(
moment(m.startDate),
moment(m.endDate),
'day',
'[]'
)
),
});
}
return grid
return grid;
}
},
mounted() {
Expand Down

0 comments on commit 1635a3a

Please sign in to comment.