java-localdatetime
Version:
### 日期工具库
55 lines (54 loc) • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AbstractDate = void 0;
var moment = require("moment");
var AbstractDate = /** @class */ (function () {
function AbstractDate() {
var _this = this;
this.momentDate = moment();
this.year = function () {
return _this.momentDate.year();
};
this.month = function () {
return _this.momentDate.month() + 1;
};
this.date = function () {
return _this.momentDate.date();
};
this.week = function () {
return _this.momentDate.week();
};
this.weekDay = function () {
return _this.momentDate.weekday();
};
this.hour = function () {
return _this.momentDate.hour();
};
this.minute = function () {
return _this.momentDate.minute();
};
this.second = function () {
return _this.momentDate.second();
};
}
AbstractDate.buildDateProperty = function (momentObj) {
var momentDate = momentObj ? momentObj : moment();
var year = momentDate.year();
var month = momentDate.month() + 1;
var week = momentDate.week();
var date = momentDate.date();
var hour = momentDate.hour();
var minute = momentDate.minute();
var second = momentDate.second();
var millisecond = momentDate.milliseconds();
return { year: year, month: month, week: week, date: date, hour: hour, minute: minute, second: second, millisecond: millisecond };
};
AbstractDate.prototype.toMoment = function () {
return this.momentDate;
};
AbstractDate.prototype.toDate = function () {
return this.momentDate.valueOf();
};
return AbstractDate;
}());
exports.AbstractDate = AbstractDate;