баг-фикс 30/34
This commit is contained in:
18
frontend/tests/local-date-format.test.mjs
Normal file
18
frontend/tests/local-date-format.test.mjs
Normal file
@@ -0,0 +1,18 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
process.env.TZ = 'Europe/Moscow';
|
||||
|
||||
const { formatLocalDate } = await import('../admin/js/utils.js');
|
||||
|
||||
test('date-only форматируется по московским компонентам, а не через UTC', () => {
|
||||
assert.equal(formatLocalDate(new Date('2026-01-01T21:15:00Z')), '2026-01-02');
|
||||
});
|
||||
|
||||
test('date-only сохраняет локальный день до московской полуночи', () => {
|
||||
assert.equal(formatLocalDate(new Date('2026-01-01T20:59:59Z')), '2026-01-01');
|
||||
});
|
||||
|
||||
test('некорректная дата отклоняется явной русской ошибкой', () => {
|
||||
assert.throws(() => formatLocalDate(new Date('invalid')), /Ожидалась корректная дата/);
|
||||
});
|
||||
Reference in New Issue
Block a user