diff --git a/bi/core.js b/bi/core.js index 0ea460553..02207954f 100644 --- a/bi/core.js +++ b/bi/core.js @@ -6392,13 +6392,12 @@ Date.prototype.getOffsetMonth = function (n) { //获得本周的起始日期 Date.prototype.getWeekStartDate = function () { var w = this.getDay(); - var offset = (w === 0 ? 7 : w); - return this.getOffsetDate(1 - offset); + return this.getOffsetDate(-w); }; //得到本周的结束日期 Date.prototype.getWeekEndDate = function () { var w = this.getDay(); - var offset = (w === 0 ? 0 : 7 - w); + var offset = (w === 0 ? 6 : 6 - w); return this.getOffsetDate(offset); }; diff --git a/docs/core.js b/docs/core.js index bb99b48a9..746c61efe 100644 --- a/docs/core.js +++ b/docs/core.js @@ -23875,13 +23875,12 @@ Date.prototype.getOffsetMonth = function (n) { //获得本周的起始日期 Date.prototype.getWeekStartDate = function () { var w = this.getDay(); - var offset = (w === 0 ? 7 : w); - return this.getOffsetDate(1 - offset); + return this.getOffsetDate(-w); }; //得到本周的结束日期 Date.prototype.getWeekEndDate = function () { var w = this.getDay(); - var offset = (w === 0 ? 0 : 7 - w); + var offset = (w === 0 ? 6 : 6 - w); return this.getOffsetDate(offset); }; diff --git a/src/core/proto/date.js b/src/core/proto/date.js index f105cae42..b25c92d15 100644 --- a/src/core/proto/date.js +++ b/src/core/proto/date.js @@ -199,13 +199,12 @@ Date.prototype.getOffsetMonth = function (n) { //获得本周的起始日期 Date.prototype.getWeekStartDate = function () { var w = this.getDay(); - var offset = (w === 0 ? 7 : w); - return this.getOffsetDate(1 - offset); + return this.getOffsetDate(-w); }; //得到本周的结束日期 Date.prototype.getWeekEndDate = function () { var w = this.getDay(); - var offset = (w === 0 ? 0 : 7 - w); + var offset = (w === 0 ? 6 : 6 - w); return this.getOffsetDate(offset); };