From 8b444a03e528541378404f044e9c435e08d03d2a Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Mon, 31 Jul 2023 21:29:28 +0200 Subject: [PATCH] Simplified initial /mealplan start date handling (fixes #2286) --- changelog/71_UNRELEASED_xxxx-xx-xx.md | 2 +- public/js/grocy.js | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/changelog/71_UNRELEASED_xxxx-xx-xx.md b/changelog/71_UNRELEASED_xxxx-xx-xx.md index d0c99308..58a34a24 100644 --- a/changelog/71_UNRELEASED_xxxx-xx-xx.md +++ b/changelog/71_UNRELEASED_xxxx-xx-xx.md @@ -21,7 +21,7 @@ ### Meal plan -- xxx +- Fixed that the meal plan did initially not display the current week when the settings `MEAL_PLAN_FIRST_DAY_OF_WEEK` and `CALENDAR_FIRST_DAY_OF_WEEK` were set to different values ### Chores diff --git a/public/js/grocy.js b/public/js/grocy.js index 97e8ac36..da85fbd8 100644 --- a/public/js/grocy.js +++ b/public/js/grocy.js @@ -668,8 +668,8 @@ $(document).on("click", ".easy-link-copy-textbox", function() if (Grocy.CalendarFirstDayOfWeek) { moment.updateLocale(moment.locale(), { - week: { - dow: Number.parseInt(Grocy.CalendarFirstDayOfWeek) + "week": { + "dow": Number.parseInt(Grocy.CalendarFirstDayOfWeek) } }); } @@ -772,18 +772,6 @@ $(window).on("message", function(e) } }); -if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES) -{ - if ($(window).width() < 768) - { - $("#meal-plan-nav-link").attr("href", $("#meal-plan-nav-link").attr("href") + "?start=" + moment().format("YYYY-MM-DD") + "&days=0"); - } - else - { - $("#meal-plan-nav-link").attr("href", $("#meal-plan-nav-link").attr("href") + "?start=" + moment().startOf("week").format("YYYY-MM-DD")); - } -} - $('[data-toggle="tooltip"][data-html="true"]').on("shown.bs.tooltip", function() { RefreshLocaleNumberDisplay(".tooltip");