MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / formatDateTimeWithSpaces

Function formatDateTimeWithSpaces

static/utils.ts:58–65  ·  view source on GitHub ↗
(d: Date)

Source from the content-addressed store, hash-verified

56}
57
58export function formatDateTimeWithSpaces(d: Date) {
59 const t = (x: string) => x.slice(-2);
60 // Hopefully some day we can use the temporal api to make this less of a pain
61 return (
62 `${d.getFullYear()} ${t('0' + (d.getMonth() + 1))} ${t('0' + d.getDate())}` +
63 `${t('0' + d.getHours())} ${t('0' + d.getMinutes())} ${t('0' + d.getSeconds())}`
64 );
65}
66
67export function formatISODate(dt: Date, full = false) {
68 const month = '' + (dt.getUTCMonth() + 1);

Callers

nothing calls this directly

Calls 1

tFunction · 0.85

Tested by

no test coverage detected