zip-build
Version:
Node package to zip your build directory and name it according to your package.json name and version.
23 lines • 1.03 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var os_1 = __importDefault(require("os"));
function getTimestampString(osPlatform) {
if (osPlatform === void 0) { osPlatform = os_1.default.platform(); }
var now = new Date();
var timestamp = now.toISOString() // '2021-12-29T15:23:47.803Z'
.slice(0, -5); // '2021-12-29T15:23:47'
if (osPlatform === 'win32') {
var nowParts = timestamp
.split('T'); // [ '2021-12-29', '15:23:47' ]
var date = nowParts[0]; // '2021-12-29'
var _a = nowParts[1] // '15:23:47'
.split(':'), hour = _a[0], min = _a[1], sec = _a[2]; // [ '15', '23', '47' ]
timestamp = "".concat(date, "T").concat(hour, "h").concat(min, "m").concat(sec, "s"); //
}
return timestamp;
}
exports.default = getTimestampString;
//# sourceMappingURL=getTimestampString.js.map