diff --git a/src/plugin/weekOfYear/index.js b/src/plugin/weekOfYear/index.js index b7c301361..e2fc9b3e8 100644 --- a/src/plugin/weekOfYear/index.js +++ b/src/plugin/weekOfYear/index.js @@ -6,11 +6,12 @@ export default (o, c, d) => { if (week !== null) { return this.add((week - this.week()) * 7, 'day') } - const endOfYear = this.endOf(Y) + // d(this) clone is for badMutable plugin + const endOfYear = d(this).endOf(Y) if (endOfYear.day() !== 6 && this.month() === 11 && (31 - this.date()) <= endOfYear.day()) { return 1 } - const startOfYear = d(this.$d).startOf(Y) + const startOfYear = d(this).startOf(Y) const compareDay = startOfYear.subtract(startOfYear.day(), D).subtract(1, MS) const diffInWeek = this.diff(compareDay, W, true) return Math.ceil(diffInWeek)