UNPKG

@tucmc/hazel

Version:
29 lines (28 loc) 860 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TimestampUtil = void 0; const Number_1 = require("../Number"); class TimestampUtil { static currentTime(timestamp, padMethod = Number_1.NumberUtil.zeroPad) { let dateTime; if (timestamp) { dateTime = new Date(timestamp); } else { dateTime = new Date(); } return { t: { h: padMethod(dateTime.getHours()), m: padMethod(dateTime.getMinutes()), s: padMethod(dateTime.getSeconds()) }, d: { d: padMethod(dateTime.getDate()), m: padMethod(dateTime.getMonth() + 1), y: padMethod(dateTime.getFullYear()) } }; } } exports.TimestampUtil = TimestampUtil;