Skip to content

Commit 1768305

Browse files
committed
chore: Update isSame before after
1 parent 8eb5404 commit 1768305

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/plugin/badMutable/index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ export default (o, c) => { // locale needed later
3636
}
3737

3838
const oldIsSame = proto.isSame
39-
proto.isSame = function () {
40-
return oldIsSame.bind(this.clone())()
39+
proto.isSame = function (that, units) {
40+
return oldIsSame.bind(this.clone())(that, units)
4141
}
4242

4343
const oldIsBefore = proto.isBefore
44-
proto.isBefore = function () {
45-
return oldIsBefore.bind(this.clone())()
44+
proto.isBefore = function (that, units) {
45+
return oldIsBefore.bind(this.clone())(that, units)
4646
}
4747

4848
const oldIsAfter = proto.isAfter
49-
proto.isAfter = function () {
50-
return oldIsAfter.bind(this.clone())()
49+
proto.isAfter = function (that, units) {
50+
return oldIsAfter.bind(this.clone())(that, units)
5151
}
5252
}
5353

test/plugin/badMutable.test.js

+3
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,11 @@ it('isAfter isBefore isSame', () => {
167167
const format = dayjs().format()
168168
d.isSame(dayjs, 'year')
169169
expect(d.format()).toBe(format)
170+
expect(d.isSame()).toBe(true)
170171
d.isBefore(dayjs, 'hour')
171172
expect(d.format()).toBe(format)
173+
expect(d.isBefore()).toBe(false)
172174
d.isAfter(dayjs, 'month')
173175
expect(d.format()).toBe(format)
176+
expect(d.isAfter()).toBe(false)
174177
})

0 commit comments

Comments
 (0)