From 5563f7a794d0930c233a1ea885dfb99a03c5ce03 Mon Sep 17 00:00:00 2001 From: Greg Date: Sat, 31 May 2025 08:32:50 +0200 Subject: [PATCH] feat: implement UI module with tab navigation, form handling and data visualization --- js/ui.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/ui.js b/js/ui.js index 19e1438..e907226 100644 --- a/js/ui.js +++ b/js/ui.js @@ -71,9 +71,11 @@ const UI = (() => { tabs[tabKey].btn.classList.add('active'); tabs[tabKey].content.classList.add('active'); - // If switching to meals tab, ensure form is populated for the current meal date + // If switching to meals tab, always reset to today and autofill if (tabKey === 'meals') { - populateMealFormForDate(document.getElementById('meal-date').value); + const todayUIDate = Utils.toUIDate(Utils.getTodayDate()); + document.getElementById('meal-date').value = todayUIDate; + populateMealFormForDate(todayUIDate); } };