Show persistent timestamps for operation and teacher messages

This commit is contained in:
鲨鱼辣椒 committed 2026-09-29 18:02:54 +08:00
1 parent 3a175101c9
commit ead3407890
24 files changed
+355 -9

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
/** Read only real, valid epoch milliseconds / ISO dates; never invent a history time. */
export function messageTimestamp(value: unknown): number | undefined {
const timestamp = typeof value === 'number' ? value
: typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T/.test(value) ? Date.parse(value) : NaN;
return Number.isFinite(timestamp) && timestamp >= 0 && !Number.isNaN(new Date(timestamp).getTime())
? timestamp : undefined;
}