MCPcopy
hub / github.com/date-fns/date-fns / format

Function format

pkgs/tz/playground.mjs:127–133  ·  view source on GitHub ↗
(date)

Source from the content-addressed store, hash-verified

125}
126
127function format(date) {
128 return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(
129 date.getDate(),
130 )}T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(
131 date.getSeconds(),
132 )}.${pad(date.getMilliseconds(), 3)}${tz(date)}`;
133}
134
135function pad(num, length = 2) {
136 return num.toString().padStart(length, "0");

Callers 2

printFunction · 0.70
tzOffsetFunction · 0.50

Calls 2

padFunction · 0.85
tzFunction · 0.70

Tested by

no test coverage detected