@feugene/mu
Version:
Helpful TS utilities without dependencies
23 lines • 656 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = toString;
const pad_1 = require("../format/pad");
/**
* Date to string
* @param {Date|null} date
* @returns {string}
*/
function toString(date = new Date()) {
return (date.getFullYear() +
'-' +
(0, pad_1.padDateTime)(date.getMonth() + 1) +
'-' +
(0, pad_1.padDateTime)(date.getDate()) +
'T' +
(0, pad_1.padDateTime)(date.getHours()) +
':' +
(0, pad_1.padDateTime)(date.getMinutes()) +
':' +
(0, pad_1.padDateTime)(date.getSeconds()));
}
//# sourceMappingURL=toString.js.map