MCPcopy
hub / github.com/vladmandic/sdnext / dateToStr

Function dateToStr

ui/logMonitor.ts:19–30  ·  view source on GitHub ↗
(ts: number)

Source from the content-addressed store, hash-verified

17let logConnected = false;
18
19function dateToStr(ts: number): string {
20 const dt = new Date(1000 * ts);
21 const year = dt.getFullYear();
22 const mo = String(dt.getMonth() + 1).padStart(2, '0');
23 const day = String(dt.getDate()).padStart(2, '0');
24 const hour = String(dt.getHours()).padStart(2, '0');
25 const min = String(dt.getMinutes()).padStart(2, '0');
26 const sec = String(dt.getSeconds()).padStart(2, '0');
27 const ms = String(dt.getMilliseconds()).padStart(3, '0');
28 const s = `${year}-${mo}-${day} ${hour}:${min}:${sec}.${ms}`;
29 return s;
30}
31
32function htmlEscape(text: string): string {
33 return text.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');

Callers 1

addLogLineFunction · 0.85

Calls 1

StringInterface · 0.85

Tested by

no test coverage detected