MCPcopy Create free account
hub / github.com/node-modules/utility / YYYYMMDDHHmmss

Function YYYYMMDDHHmmss

src/date.ts:112–128  ·  view source on GitHub ↗
(d?: Date | string | number, options?: YYYYMMDDHHmmssOptions)

Source from the content-addressed store, hash-verified

110 * `moment().format('YYYY-MM-DD HH:mm:ss')` format date string.
111 */
112export function YYYYMMDDHHmmss(d?: Date | string | number, options?: YYYYMMDDHHmmssOptions): string {
113 d = d || new Date();
114 if (!(d instanceof Date)) {
115 d = new Date(d);
116 }
117
118 let dateSep = '-';
119 let timeSep = ':';
120 if (options?.dateSep) {
121 dateSep = options.dateSep;
122 }
123 if (options?.timeSep) {
124 timeSep = options.timeSep;
125 }
126 const [ year, month, date, hours, minutes, seconds ] = getDateStringParts(d);
127 return `${year}${dateSep}${month}${dateSep}${date} ${hours}${timeSep}${minutes}${timeSep}${seconds}`;
128}
129
130/**
131 * `moment().format('YYYY-MM-DD')` format date string.

Callers 2

date.test.tsFile · 0.85
getDateFromMillisecondsFunction · 0.85

Calls 1

getDateStringPartsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…