Browse Source

周首改成周一

es6
windy 7 years ago
parent
commit
7cffb79476
  1. 12
      bi/core.js
  2. 12
      dist/bundle.js
  3. 2
      dist/bundle.min.js
  4. 12
      dist/core.js
  5. 12
      src/core/proto/date.js

12
bi/core.js

@ -20887,16 +20887,17 @@ Date.prototype.getDayOfYear = function () {
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
//周一是一周第一天 //周一是一周第一天
var week = d.getDay(); var week = d.getDay() === 0 ? 7 : d.getDay();
//var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - week); d.setDate(this.getDate() - (week - 1));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() > 0) { if (d.getDay() !== 1) {
offset++; offset++;
} }
return offset; return offset;
@ -20976,13 +20977,12 @@ Date.prototype.getOffsetMonth = function (n) {
//获得本周的起始日期 //获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(-w); return this.getOffsetDate(w === 0 ? -6 : 1 - w);
}; };
//得到本周的结束日期 //得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
var offset = (w === 0 ? 6 : 6 - w); return this.getOffsetDate(w === 0 ? 0 : 7 - w);
return this.getOffsetDate(offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */

12
dist/bundle.js vendored

@ -20887,16 +20887,17 @@ Date.prototype.getDayOfYear = function () {
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
//周一是一周第一天 //周一是一周第一天
var week = d.getDay(); var week = d.getDay() === 0 ? 7 : d.getDay();
//var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - week); d.setDate(this.getDate() - (week - 1));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() > 0) { if (d.getDay() !== 1) {
offset++; offset++;
} }
return offset; return offset;
@ -20976,13 +20977,12 @@ Date.prototype.getOffsetMonth = function (n) {
//获得本周的起始日期 //获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(-w); return this.getOffsetDate(w === 0 ? -6 : 1 - w);
}; };
//得到本周的结束日期 //得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
var offset = (w === 0 ? 6 : 6 - w); return this.getOffsetDate(w === 0 ? 0 : 7 - w);
return this.getOffsetDate(offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */

2
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

12
dist/core.js vendored

@ -20887,16 +20887,17 @@ Date.prototype.getDayOfYear = function () {
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
//周一是一周第一天 //周一是一周第一天
var week = d.getDay(); var week = d.getDay() === 0 ? 7 : d.getDay();
//var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - week); d.setDate(this.getDate() - (week - 1));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() > 0) { if (d.getDay() !== 1) {
offset++; offset++;
} }
return offset; return offset;
@ -20976,13 +20977,12 @@ Date.prototype.getOffsetMonth = function (n) {
//获得本周的起始日期 //获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(-w); return this.getOffsetDate(w === 0 ? -6 : 1 - w);
}; };
//得到本周的结束日期 //得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
var offset = (w === 0 ? 6 : 6 - w); return this.getOffsetDate(w === 0 ? 0 : 7 - w);
return this.getOffsetDate(offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */

12
src/core/proto/date.js

@ -109,16 +109,17 @@ Date.prototype.getDayOfYear = function () {
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
//周一是一周第一天 //周一是一周第一天
var week = d.getDay(); var week = d.getDay() === 0 ? 7 : d.getDay();
//var week = d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
d.setDate(this.getDate() - week); d.setDate(this.getDate() - (week - 1));
var ms = d.valueOf(); // GMT var ms = d.valueOf(); // GMT
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() > 0) { if (d.getDay() !== 1) {
offset++; offset++;
} }
return offset; return offset;
@ -198,13 +199,12 @@ Date.prototype.getOffsetMonth = function (n) {
//获得本周的起始日期 //获得本周的起始日期
Date.prototype.getWeekStartDate = function () { Date.prototype.getWeekStartDate = function () {
var w = this.getDay(); var w = this.getDay();
return this.getOffsetDate(-w); return this.getOffsetDate(w === 0 ? -6 : 1 - w);
}; };
//得到本周的结束日期 //得到本周的结束日期
Date.prototype.getWeekEndDate = function () { Date.prototype.getWeekEndDate = function () {
var w = this.getDay(); var w = this.getDay();
var offset = (w === 0 ? 6 : 6 - w); return this.getOffsetDate(w === 0 ? 0 : 7 - w);
return this.getOffsetDate(offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */

Loading…
Cancel
Save