From 69d7a87f1be1de3bc56abeb7963a6efad1ffe07a Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 10 May 2017 11:56:09 +0800 Subject: [PATCH] update --- bi/core.js | 13 +++++++++++++ docs/core.js | 13 +++++++++++++ src/core/proto/date.js | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/bi/core.js b/bi/core.js index 618a27626..d231221cd 100644 --- a/bi/core.js +++ b/bi/core.js @@ -6388,6 +6388,19 @@ Date.prototype.getOffsetMonth = function (n) { return dt; }; +//获得本周的起始日期 +Date.prototype.getWeekStartDate = function () { + var w = this.getDay(); + var offset = (w === 0 ? 7 : w); + return this.getOffsetDate(1 - offset); +}; +//得到本周的结束日期 +Date.prototype.getWeekEndDate = function () { + var w = this.getDay(); + var offset = (w === 0 ? 0 : 7 - w); + return this.getOffsetDate(offset); +}; + //获得本季度的起始日期 Date.prototype.getQuarterStartDate = function () { return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); diff --git a/docs/core.js b/docs/core.js index aeb3c209a..0fe1565f2 100644 --- a/docs/core.js +++ b/docs/core.js @@ -23868,6 +23868,19 @@ Date.prototype.getOffsetMonth = function (n) { return dt; }; +//获得本周的起始日期 +Date.prototype.getWeekStartDate = function () { + var w = this.getDay(); + var offset = (w === 0 ? 7 : w); + return this.getOffsetDate(1 - offset); +}; +//得到本周的结束日期 +Date.prototype.getWeekEndDate = function () { + var w = this.getDay(); + var offset = (w === 0 ? 0 : 7 - w); + return this.getOffsetDate(offset); +}; + //获得本季度的起始日期 Date.prototype.getQuarterStartDate = function () { return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); diff --git a/src/core/proto/date.js b/src/core/proto/date.js index e3146708b..f105cae42 100644 --- a/src/core/proto/date.js +++ b/src/core/proto/date.js @@ -196,6 +196,19 @@ Date.prototype.getOffsetMonth = function (n) { return dt; }; +//获得本周的起始日期 +Date.prototype.getWeekStartDate = function () { + var w = this.getDay(); + var offset = (w === 0 ? 7 : w); + return this.getOffsetDate(1 - offset); +}; +//得到本周的结束日期 +Date.prototype.getWeekEndDate = function () { + var w = this.getDay(); + var offset = (w === 0 ? 0 : 7 - w); + return this.getOffsetDate(offset); +}; + //获得本季度的起始日期 Date.prototype.getQuarterStartDate = function () { return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1);