Fix issue with crashing when having no entries today
This commit is contained in:
@@ -34,9 +34,10 @@
|
||||
remainingToday = $settingsStore.target;
|
||||
let now = new Date();
|
||||
let todayDate = formatter.format(now);
|
||||
const [day, month, year] = todayDate.split('/');
|
||||
const [day, month, year] = todayDate.split("/");
|
||||
todayDate = `${year}-${month}-${day}`;
|
||||
|
||||
if ($foodStore) {
|
||||
$foodStore.forEach((food) => {
|
||||
if (food.date.split("T")[0] == todayDate) {
|
||||
remainingToday -= food.energy;
|
||||
@@ -44,6 +45,7 @@
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
remainingToday = Math.round(remainingToday);
|
||||
computeColor();
|
||||
}
|
||||
|
Reference in New Issue
Block a user