Skip to content

Commit 3b63011

Browse files
test: fix date tests (#29)
1 parent 0b472dd commit 3b63011

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

test/dates.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,8 @@ Date.prototype.getTimezoneOffset = function() {
1313
return -120;
1414
};
1515

16-
function date(year, month, day, hour, minute, second, millisecond) {
17-
var d = new Date();
18-
19-
d.setFullYear(year);
20-
d.setMonth(month - 1);
21-
d.setDate(day);
22-
d.setHours(hour ? hour : 0, minute ? minute : 0, second ? second : 0, millisecond ? millisecond : 0);
23-
24-
return d;
16+
function date(year, month = 1, day = 1, hour = 0, minute = 0, second = 0, millisecond = 0) {
17+
return new Date(year, month - 1, day, hour, minute, second, millisecond);
2518
}
2619

2720
describe('date formatting', () => {

0 commit comments

Comments
 (0)