Added basic date maths (release 0.1.0.021)
This commit is contained in:
parent
4ffccd8b1e
commit
7491df9c75
38
ryjsxt.js
38
ryjsxt.js
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* Ray's JavaScript Extension
|
||||
* @version v0.1.0.018 (2023/12/09 0356)
|
||||
* @version v0.1.0.021 (2023/12/11 0056)
|
||||
*/
|
||||
|
||||
|
||||
|
@ -166,6 +166,42 @@ Boolean.ifTrue = function(value, trueValue, falseValue) {
|
|||
|
||||
|
||||
|
||||
Date.addDays = function (date, days) {
|
||||
let result = new Date(date);
|
||||
|
||||
result.addDays(days);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Date.addMonths = function (date, months) {
|
||||
let result = new Date(date);
|
||||
|
||||
result.addMonths(months);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Date.addYears = function (date, years) {
|
||||
let result = new Date(date);
|
||||
|
||||
result.addYears(years);
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
Date.prototype.addDays = function (days) {
|
||||
this.setDate(this.getDate() + parseInt(days));
|
||||
}
|
||||
|
||||
Date.prototype.addMonths = function (months) {
|
||||
this.setMonth(this.getMonth() + parseInt(months));
|
||||
}
|
||||
|
||||
Date.prototype.addYears = function (years) {
|
||||
this.setFullYear(this.getFullYear() + parseInt(years));
|
||||
}
|
||||
|
||||
Date.prototype.toCString = function(pattern) {
|
||||
let result = pattern;
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue