ngx-bootstrap
Version:
Native Angular Bootstrap Components
17 lines • 832 B
JavaScript
var defaultTimeUnit = {
year: 0, month: 0, day: 0, hour: 0, minute: 0, seconds: 0
};
export function createDate(year, month, day, hour, minute, seconds) {
if (month === void 0) { month = 0; }
if (day === void 0) { day = 1; }
if (hour === void 0) { hour = 0; }
if (minute === void 0) { minute = 0; }
if (seconds === void 0) { seconds = 0; }
var _date = new Date();
return new Date(year || _date.getFullYear(), month, day, hour, minute, seconds);
}
export function changeDate(date, unit) {
var _unit = Object.assign({}, defaultTimeUnit, unit);
return createDate(date.getFullYear() + _unit.year, date.getMonth() + _unit.month, date.getDate() + _unit.day, date.getHours() + _unit.hour, date.getMinutes() + _unit.minute, date.getSeconds() + _unit.seconds);
}
//# sourceMappingURL=date-utils.js.map