refactor: show mileage data freshness

This commit is contained in:
kkfluous
2026-08-07 15:50:24 +08:00
parent de2a0896c4
commit 8c6a3ad831
3 changed files with 38 additions and 4 deletions
@@ -0,0 +1,12 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { formatMileageSnapshotTime } from './data-freshness.js';
test('formats snapshot instants in Asia/Shanghai', () => {
assert.equal(formatMileageSnapshotTime('2026-08-07T07:45:06.000Z'), '15:45:06');
});
test('keeps historical date snapshots explicit', () => {
assert.equal(formatMileageSnapshotTime('2026-08-06'), '2026-08-06');
assert.equal(formatMileageSnapshotTime(null), '--:--:--');
});