refactor: refs #8697 simplify date handling in ItemDiary component #1532

Merged
pablone merged 3 commits from 8697-fixScrollToView into test 2025-03-03 11:49:47 +00:00
1 changed files with 5 additions and 10 deletions

View File

@ -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) {
</QTd>
</template>
<template #body-cell-date="{ row }">
<QTd @click.stop :data-date="formatDateForAttribute(row.shipped)">
<QTd @click.stop :data-date="row?.shipped.substring(0, 10)">
<QBadge
v-bind="getBadgeAttrs(row.shipped)"
class="q-ma-none"