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

+4 -2
View File
@@ -8,7 +8,7 @@ from datetime import datetime, timezone
from io import BytesIO
from pathlib import Path
from app.belki.admin_filters import matches_period, period_bounds
from app.belki.admin_filters import WEB_TIMEZONE, matches_period, period_bounds
from app.belki.xlsx_export import build_xlsx
from app.main import BelkiHTTPServer, Handler
@@ -21,9 +21,11 @@ class AdminFilterAndExportTests(unittest.TestCase):
self.assertTrue(matches_period(recent, *period_bounds("2h", None, None, now=now)))
self.assertFalse(matches_period(old, *period_bounds("2h", None, None, now=now)))
self.assertTrue(matches_period(old, *period_bounds("all", "2026-08-30", "2026-08-30", now=now)))
start, _ = period_bounds("all", "2026-08-30", "2026-08-30", now=now)
self.assertEqual(start, datetime(2026, 8, 29, 21, tzinfo=timezone.utc))
def test_xlsx_is_a_valid_workbook_with_filters_and_typed_values(self) -> None:
content = build_xlsx(sheet_name="Отчёты", headers=["ID", "Создан", "Текст"], rows=[[7, datetime(2026, 9, 1, 12, 30, tzinfo=timezone.utc), "Только выбранная строка"]])
content = build_xlsx(sheet_name="Отчёты", headers=["ID", "Создан", "Текст"], rows=[[7, datetime(2026, 9, 1, 12, 30, tzinfo=timezone.utc), "Только выбранная строка"]], display_timezone=WEB_TIMEZONE)
with zipfile.ZipFile(BytesIO(content)) as archive:
self.assertTrue(archive.testzip() is None)
sheet = archive.read("xl/worksheets/sheet1.xml").decode()