From f9b410405d632a4c820238e14edc9dc742cafc9b Mon Sep 17 00:00:00 2001 From: pablone Date: Mon, 3 Mar 2025 09:13:38 +0100 Subject: [PATCH] refactor: refs #8697 simplify date handling in ItemDiary component --- src/pages/Item/Card/ItemDiary.vue | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/pages/Item/Card/ItemDiary.vue b/src/pages/Item/Card/ItemDiary.vue index 83cd562a0..f839c1f71 100644 --- a/src/pages/Item/Card/ItemDiary.vue +++ b/src/pages/Item/Card/ItemDiary.vue @@ -158,15 +158,10 @@ const getBadgeAttrs = (_date) => { const scrollToToday = async () => { await nextTick(); - const todayCell = document.querySelector(`td[data-date="${today.toISOString()}"]`); - if (todayCell) { - todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' }); - } -}; - -const formatDateForAttribute = (dateValue) => { - if (dateValue instanceof Date) return date.formatDate(dateValue, 'YYYY-MM-DD'); - return dateValue; + const todayCell = document.querySelector( + `td[data-date="${date.formatDate(today, 'YYYY-MM-DD')}"]`, + ); + if (todayCell) todayCell.scrollIntoView({ behavior: 'smooth', block: 'center' }); }; async function updateWarehouse(warehouseFk) { @@ -242,7 +237,7 @@ async function updateWarehouse(warehouseFk) {