MCPcopy Index your code
hub / github.com/acode/cli / formatDate

Function formatDate

cli/tabler.js:15–27  ·  view source on GitHub ↗
(dt)

Source from the content-addressed store, hash-verified

13}
14
15function formatDate (dt) {
16 dt = dt instanceof Date ? dt : new Date(dt);
17 let months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov'.split(' ');
18 let suffix = 'th st nd rd th th th th th th'.split(' ');
19 let m = months[dt.getMonth()];
20 let y = dt.getFullYear();
21 let d = zeroPad(dt.getDate(), 2);
22 let th = suffix[dt.getDate() % 10];
23 let hh = zeroPad(dt.getHours(), 2);
24 let mm = zeroPad(dt.getMinutes(), 2);
25 let ss = zeroPad(dt.getSeconds(), 2);
26 return `${m} ${d} ${y} ${hh}:${mm}`;
27}
28
29module.exports = (fields, objects, consoleOutput, isOption) => {
30

Callers 1

tabler.jsFile · 0.70

Calls 1

zeroPadFunction · 0.85

Tested by

no test coverage detected