forgot to build
This commit is contained in:
parent
71c9334dcd
commit
8f97095fbc
2 changed files with 62 additions and 16 deletions
14
dist/utils/FullDate.d.ts
vendored
14
dist/utils/FullDate.d.ts
vendored
|
@ -1,10 +1,16 @@
|
|||
export declare class FullDate {
|
||||
private date;
|
||||
private _date;
|
||||
constructor(...argv: any);
|
||||
toString(): string;
|
||||
toJSON(): string;
|
||||
valueOf(): number;
|
||||
getFullYear(): number;
|
||||
getMonth(): number;
|
||||
getDate(): number;
|
||||
get date(): Date;
|
||||
get year(): number;
|
||||
get month(): number;
|
||||
get day(): number;
|
||||
get dayOfWeek(): number;
|
||||
set year(val: number);
|
||||
set month(val: number);
|
||||
set day(val: number);
|
||||
advance(period: number): FullDate;
|
||||
}
|
||||
|
|
64
dist/utils/FullDate.js
vendored
64
dist/utils/FullDate.js
vendored
|
@ -6,7 +6,7 @@ var FullDate = /** @class */ (function () {
|
|||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
argv[_i] = arguments[_i];
|
||||
}
|
||||
this.date = (function () {
|
||||
this._date = (function () {
|
||||
var _a;
|
||||
if (argv.length == 1) {
|
||||
var arg = argv[0];
|
||||
|
@ -28,7 +28,7 @@ var FullDate = /** @class */ (function () {
|
|||
})();
|
||||
}
|
||||
FullDate.prototype.toString = function () {
|
||||
var d = this.date;
|
||||
var d = this._date;
|
||||
var f = function (s) { return ('0' + s).slice(-2); };
|
||||
return d.getFullYear() + "-" + f(d.getMonth() + 1) + "-" + f(d.getDate());
|
||||
};
|
||||
|
@ -36,17 +36,57 @@ var FullDate = /** @class */ (function () {
|
|||
return this.toString();
|
||||
};
|
||||
FullDate.prototype.valueOf = function () {
|
||||
return new Date(this.date).setHours(0, 0, 0, 0);
|
||||
return new Date(this._date).setHours(0, 0, 0, 0);
|
||||
};
|
||||
// prop
|
||||
FullDate.prototype.getFullYear = function () {
|
||||
return this.date.getFullYear();
|
||||
};
|
||||
FullDate.prototype.getMonth = function () {
|
||||
return this.date.getMonth() + 1;
|
||||
};
|
||||
FullDate.prototype.getDate = function () {
|
||||
return this.date.getDate();
|
||||
Object.defineProperty(FullDate.prototype, "date", {
|
||||
// getter
|
||||
get: function () {
|
||||
return new Date(this._date);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(FullDate.prototype, "year", {
|
||||
get: function () {
|
||||
return this._date.getFullYear();
|
||||
},
|
||||
// setter
|
||||
set: function (val) {
|
||||
this._date.setFullYear(val);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(FullDate.prototype, "month", {
|
||||
get: function () {
|
||||
return this._date.getMonth() + 1;
|
||||
},
|
||||
set: function (val) {
|
||||
this._date.setMonth(val - 1);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(FullDate.prototype, "day", {
|
||||
get: function () {
|
||||
return this._date.getDate();
|
||||
},
|
||||
set: function (val) {
|
||||
this._date.setDate(val);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(FullDate.prototype, "dayOfWeek", {
|
||||
get: function () {
|
||||
return this._date.getDay();
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
// func
|
||||
FullDate.prototype.advance = function (period) {
|
||||
return new FullDate(this._date.valueOf() + period * 86400e3);
|
||||
};
|
||||
return FullDate;
|
||||
}());
|
||||
|
|
Reference in a new issue