Show persistent timestamps for operation and teacher messages
This commit is contained in:
1 parent
3a175101c9
commit
ead3407890
24 files changed
+355
-9
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user