diff --git a/src/plugin/badMutable/index.js b/src/plugin/badMutable/index.js index f95d581c6..c82aafb67 100644 --- a/src/plugin/badMutable/index.js +++ b/src/plugin/badMutable/index.js @@ -36,18 +36,18 @@ export default (o, c) => { // locale needed later } const oldIsSame = proto.isSame - proto.isSame = function () { - return oldIsSame.bind(this.clone())() + proto.isSame = function (that, units) { + return oldIsSame.bind(this.clone())(that, units) } const oldIsBefore = proto.isBefore - proto.isBefore = function () { - return oldIsBefore.bind(this.clone())() + proto.isBefore = function (that, units) { + return oldIsBefore.bind(this.clone())(that, units) } const oldIsAfter = proto.isAfter - proto.isAfter = function () { - return oldIsAfter.bind(this.clone())() + proto.isAfter = function (that, units) { + return oldIsAfter.bind(this.clone())(that, units) } } diff --git a/test/plugin/badMutable.test.js b/test/plugin/badMutable.test.js index e68128914..5b38bc899 100644 --- a/test/plugin/badMutable.test.js +++ b/test/plugin/badMutable.test.js @@ -167,8 +167,11 @@ it('isAfter isBefore isSame', () => { const format = dayjs().format() d.isSame(dayjs, 'year') expect(d.format()).toBe(format) + expect(d.isSame()).toBe(true) d.isBefore(dayjs, 'hour') expect(d.format()).toBe(format) + expect(d.isBefore()).toBe(false) d.isAfter(dayjs, 'month') expect(d.format()).toBe(format) + expect(d.isAfter()).toBe(false) })