fix: present web timestamps in UTC+3

This commit is contained in:
nyan404 committed 2026-09-01 01:51:29 +03:00
1 parent 00bbe66c77
commit cffaaac755
8 files changed
+25 -18

No files matched your search

+2 -2
View File
@@ -116,7 +116,7 @@
<a id="reportsExport" class="export-link" href="/api/admin/calculations.xlsx">Скачать XLSX</a>
</section>
<p class="error" id="error" role="alert"></p>
<div class="table-wrap"><table><thead><tr><th>Кот</th><th>Котята</th><th>Фото</th><th>Дата</th><th>Сообщение</th><th>Автор</th><th>ID</th><th></th></tr></thead><tbody id="rows"><tr><td class="empty" colspan="8">Загрузка истории…</td></tr></tbody></table></div>
<div class="table-wrap"><table><thead><tr><th>Кот</th><th>Котята</th><th>Фото</th><th>Дата (UTC+3)</th><th>Сообщение</th><th>Автор</th><th>ID</th><th></th></tr></thead><tbody id="rows"><tr><td class="empty" colspan="8">Загрузка истории…</td></tr></tbody></table></div>
</section>
<section id="applicationsView" class="admin-section applications hidden" aria-labelledby="applicationsTitle"><header class="topbar"><div><h2 id="applicationsTitle">Заявки</h2><p class="intro">Новые обращения из VK-бота и веб-формы.</p></div><div class="record-count" id="applicationCount">Заявки не загружены</div></header><nav class="tabs" aria-label="Статус заявок"><button class="application-tab tab" type="button" data-status="pending" aria-selected="true">Новые</button><button class="application-tab tab" type="button" data-status="accepted" aria-selected="false">Принятые</button><button class="application-tab tab" type="button" data-status="" aria-selected="false">Все</button></nav><section class="controls" aria-label="Фильтры заявок"><label class="control-group">Период<select id="applicationPeriod"><option value="all">Вся история</option><option value="year">Последний год</option><option value="month">Последний месяц</option><option value="week">Последняя неделя</option><option value="day">Последние сутки</option><option value="12h">Последние 12 часов</option><option value="6h">Последние 6 часов</option><option value="4h">Последние 4 часа</option><option value="2h">Последние 2 часа</option><option value="1h">Последний час</option></select></label><label class="control-group">С даты<input id="applicationDateFrom" type="date"></label><label class="control-group">По дату<input id="applicationDateTo" type="date"></label><button id="loadApplications" type="button">Обновить</button><a id="applicationsExport" class="export-link" href="/api/admin/applications.xlsx">Скачать XLSX</a></section><div class="application-layout"><div id="applicationList" class="application-list"><p class="empty">Загрузка заявок…</p></div><article id="applicationDetail" class="application-detail"><p class="empty">Выберите заявку слева.</p></article></div></section>
</section>
@@ -170,7 +170,7 @@
if (gallery.childElementCount) node.append(gallery); else node.textContent = '—'; return node;
}
// Formats stored ISO timestamps for the Russian admin table without shifting their clock time.
function displayDate(value) { const match = String(value || '').match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}:\d{2}:\d{2})/); return match ? `${match[4]} ${match[3]}-${match[2]}-${match[1]}` : (value || '—'); }
function displayDate(value) { const text = String(value || ''); if (!text) return '—'; const normalized = text.includes('T') ? text : text.replace(' ', 'T'); const instant = new Date(/[zZ]|[+-]\d\d:\d\d$/.test(normalized) ? normalized : `${normalized}Z`); return Number.isNaN(instant.valueOf()) ? text : new Intl.DateTimeFormat('ru-RU', {timeZone: 'Europe/Moscow', dateStyle: 'short', timeStyle: 'medium'}).format(instant); }
// Produces the normalized value used by the selected table sort column.
function textForSort(item, field) { const input = item.input || {}; const person = personData(input); const kittens = kittenEntries(input); if (field === 'cat') return `${person.name} ${person.id}`.toLocaleLowerCase(); if (field === 'kitten') return kittens.map(item => `${item.name} ${item.id}`).join(',').toLocaleLowerCase(); if (field === 'photo') return (input.attachments || []).length; if (field === 'date') return item.created_at || ''; if (field === 'message') return item.message || ''; if (field === 'author') return String(item.actor_id || ''); return Number(item.id) || 0; }
// Maps an input payload to the report category used by tabs and filters.