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); } };