Browse Source

Merge pull request #40 in ~GUY/fineui from ~WINDY/fineui:master to master

* commit '7b1679a30d61cefef27dca0f33904fd3b66f9c59':
  月份偏移方法
master
windy 8 years ago
parent
commit
2ec0b94b45
  1. 14
      bi/core.js
  2. 14
      docs/core.js
  3. 14
      src/core/proto/date.js

14
bi/core.js

@ -6354,6 +6354,20 @@ Date.prototype.getQuarterStartMonth = function () {
}
return quarterStartMonth;
};
//指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime());
var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if(day > monthDay){
day = monthDay;
}
dt.setDate(day);
dt.setMonth(dt.getMonth() + parseInt(n));
return dt;
};
//获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1);

14
docs/core.js

@ -23834,6 +23834,20 @@ Date.prototype.getQuarterStartMonth = function () {
}
return quarterStartMonth;
};
//指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime());
var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if(day > monthDay){
day = monthDay;
}
dt.setDate(day);
dt.setMonth(dt.getMonth() + parseInt(n));
return dt;
};
//获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1);

14
src/core/proto/date.js

@ -182,6 +182,20 @@ Date.prototype.getQuarterStartMonth = function () {
}
return quarterStartMonth;
};
//指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime());
var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if(day > monthDay){
day = monthDay;
}
dt.setDate(day);
dt.setMonth(dt.getMonth() + parseInt(n));
return dt;
};
//获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1);

Loading…
Cancel
Save