Skip to content

Commit efa5eab

Browse files
committed
Address review feedback
1 parent 0026b12 commit efa5eab

File tree

3 files changed

+67
-65
lines changed
  • test/built-ins/Temporal
    • PlainDateTime/prototype/daysInMonth
    • PlainDate/prototype/daysInMonth
    • ZonedDateTime/prototype/daysInMonth

3 files changed

+67
-65
lines changed

test/built-ins/Temporal/PlainDate/prototype/daysInMonth/basic.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,35 @@ const tests = [
1212
[new Temporal.PlainDate(1976, 11, 18), 30],
1313
[new Temporal.PlainDate(1976, 12, 18), 31],
1414
[new Temporal.PlainDate(1977, 2, 18), 28],
15+
[new Temporal.PlainDate(2021, 1, 15), 31],
16+
[new Temporal.PlainDate(2020, 2, 15), 29],
17+
[new Temporal.PlainDate(2000, 2, 15), 29],
18+
[new Temporal.PlainDate(2021, 2, 15), 28],
19+
[new Temporal.PlainDate(2021, 3, 15), 31],
20+
[new Temporal.PlainDate(2021, 4, 15), 30],
21+
[new Temporal.PlainDate(2021, 5, 15), 31],
22+
[new Temporal.PlainDate(2021, 6, 15), 30],
23+
[new Temporal.PlainDate(2021, 7, 15), 31],
24+
[new Temporal.PlainDate(2021, 8, 15), 31],
25+
[new Temporal.PlainDate(2021, 9, 15), 30],
26+
[new Temporal.PlainDate(2021, 10, 15), 31],
27+
[new Temporal.PlainDate(2021, 11, 15), 30],
28+
[new Temporal.PlainDate(2021, 12, 15), 31],
29+
[Temporal.PlainDate.from('2019-01-18'), 31],
30+
[Temporal.PlainDate.from('2020-02-18'), 29],
31+
[Temporal.PlainDate.from('2019-02-18'), 28],
32+
[Temporal.PlainDate.from('2019-03-18'), 31],
33+
[Temporal.PlainDate.from('2019-04-18'), 30],
34+
[Temporal.PlainDate.from('2019-05-18'), 31],
35+
[Temporal.PlainDate.from('2019-06-18'), 30],
36+
[Temporal.PlainDate.from('2019-07-18'), 31],
37+
[Temporal.PlainDate.from('2019-08-18'), 31],
38+
[Temporal.PlainDate.from('2019-09-18'), 30],
39+
[Temporal.PlainDate.from('2019-10-18'), 31],
40+
[Temporal.PlainDate.from('2019-11-18'), 30],
41+
[Temporal.PlainDate.from('2019-12-18'), 31],
1542
];
1643
for (const [plainDate, expected] of tests) {
1744
assert.sameValue(plainDate.daysInMonth, expected, `${expected} days in the month of ${plainDate}`);
1845
}
1946

20-
assert.sameValue((new Temporal.PlainDate(2021, 1, 15)).daysInMonth, 31);
21-
assert.sameValue((new Temporal.PlainDate(2020, 2, 15)).daysInMonth, 29);
22-
assert.sameValue((new Temporal.PlainDate(2000, 2, 15)).daysInMonth, 29);
23-
assert.sameValue((new Temporal.PlainDate(2021, 2, 15)).daysInMonth, 28);
24-
assert.sameValue((new Temporal.PlainDate(2021, 3, 15)).daysInMonth, 31);
25-
assert.sameValue((new Temporal.PlainDate(2021, 4, 15)).daysInMonth, 30);
26-
assert.sameValue((new Temporal.PlainDate(2021, 5, 15)).daysInMonth, 31);
27-
assert.sameValue((new Temporal.PlainDate(2021, 6, 15)).daysInMonth, 30);
28-
assert.sameValue((new Temporal.PlainDate(2021, 7, 15)).daysInMonth, 31);
29-
assert.sameValue((new Temporal.PlainDate(2021, 8, 15)).daysInMonth, 31);
30-
assert.sameValue((new Temporal.PlainDate(2021, 9, 15)).daysInMonth, 30);
31-
assert.sameValue((new Temporal.PlainDate(2021, 10, 15)).daysInMonth, 31);
32-
assert.sameValue((new Temporal.PlainDate(2021, 11, 15)).daysInMonth, 30);
33-
assert.sameValue((new Temporal.PlainDate(2021, 12, 15)).daysInMonth, 31);
34-
assert.sameValue(Temporal.PlainDate.from('2019-01-18').daysInMonth, 31);
35-
assert.sameValue(Temporal.PlainDate.from('2020-02-18').daysInMonth, 29);
36-
assert.sameValue(Temporal.PlainDate.from('2019-02-18').daysInMonth, 28);
37-
assert.sameValue(Temporal.PlainDate.from('2019-03-18').daysInMonth, 31);
38-
assert.sameValue(Temporal.PlainDate.from('2019-04-18').daysInMonth, 30);
39-
assert.sameValue(Temporal.PlainDate.from('2019-05-18').daysInMonth, 31);
40-
assert.sameValue(Temporal.PlainDate.from('2019-06-18').daysInMonth, 30);
41-
assert.sameValue(Temporal.PlainDate.from('2019-07-18').daysInMonth, 31);
42-
assert.sameValue(Temporal.PlainDate.from('2019-08-18').daysInMonth, 31);
43-
assert.sameValue(Temporal.PlainDate.from('2019-09-18').daysInMonth, 30);
44-
assert.sameValue(Temporal.PlainDate.from('2019-10-18').daysInMonth, 31);
45-
assert.sameValue(Temporal.PlainDate.from('2019-11-18').daysInMonth, 30);
46-
assert.sameValue(Temporal.PlainDate.from('2019-12-18').daysInMonth, 31);

test/built-ins/Temporal/PlainDateTime/prototype/daysInMonth/basic.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,27 @@ features: [Temporal]
88
---*/
99

1010
const tests = [
11-
[new Temporal.PlainDateTime(1976, 2, 18, 15, 23, 30, 123, 456, 789), 29],
12-
[new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789), 30],
13-
[new Temporal.PlainDateTime(1976, 12, 18, 15, 23, 30, 123, 456, 789), 31],
14-
[new Temporal.PlainDateTime(1977, 2, 18, 15, 23, 30, 123, 456, 789), 28],
11+
[1976, 2, 18, 15, 23, 30, 29],
12+
[1976, 11, 18, 15, 23, 30, 30],
13+
[1976, 12, 18, 15, 23, 30, 31],
14+
[1977, 2, 18, 15, 23, 30, 28],
15+
[1997, 1, 23, 5, 30, 13, 31],
16+
[1996, 2, 23, 5, 30, 13, 29],
17+
[2000, 2, 23, 5, 30, 13, 29],
18+
[1997, 2, 23, 5, 30, 13, 28],
19+
[1997, 3, 23, 5, 30, 13, 31],
20+
[1997, 4, 23, 5, 30, 13, 30],
21+
[1997, 5, 23, 5, 30, 13, 31],
22+
[1997, 6, 23, 5, 30, 13, 30],
23+
[1997, 7, 23, 5, 30, 13, 31],
24+
[1997, 8, 23, 5, 30, 13, 31],
25+
[1997, 9, 23, 5, 30, 13, 30],
26+
[1997, 10, 23, 5, 30, 13, 31],
27+
[1997, 11, 23, 5, 30, 13, 30],
28+
[1997, 12, 23, 5, 30, 13, 31],
1529
];
16-
for (const [plainDateTime, expected] of tests) {
30+
for (const [year, month, day, hour, minute, second, expected] of tests) {
31+
const plainDateTime = new Temporal.PlainDateTime(year, month, day, hour, minute, second, 123, 456, 789);
1732
assert.sameValue(plainDateTime.daysInMonth, expected, `${expected} days in the month of ${plainDateTime}`);
1833
}
1934

20-
assert.sameValue((new Temporal.PlainDateTime(1997, 1, 23, 5, 30, 13)).daysInMonth, 31);
21-
assert.sameValue((new Temporal.PlainDateTime(1996, 2, 23, 5, 30, 13)).daysInMonth, 29);
22-
assert.sameValue((new Temporal.PlainDateTime(2000, 2, 23, 5, 30, 13)).daysInMonth, 29);
23-
assert.sameValue((new Temporal.PlainDateTime(1997, 2, 23, 5, 30, 13)).daysInMonth, 28);
24-
assert.sameValue((new Temporal.PlainDateTime(1997, 3, 23, 5, 30, 13)).daysInMonth, 31);
25-
assert.sameValue((new Temporal.PlainDateTime(1997, 4, 23, 5, 30, 13)).daysInMonth, 30);
26-
assert.sameValue((new Temporal.PlainDateTime(1997, 5, 23, 5, 30, 13)).daysInMonth, 31);
27-
assert.sameValue((new Temporal.PlainDateTime(1997, 6, 23, 5, 30, 13)).daysInMonth, 30);
28-
assert.sameValue((new Temporal.PlainDateTime(1997, 7, 23, 5, 30, 13)).daysInMonth, 31);
29-
assert.sameValue((new Temporal.PlainDateTime(1997, 8, 23, 5, 30, 13)).daysInMonth, 31);
30-
assert.sameValue((new Temporal.PlainDateTime(1997, 9, 23, 5, 30, 13)).daysInMonth, 30);
31-
assert.sameValue((new Temporal.PlainDateTime(1997, 10, 23, 5, 30, 13)).daysInMonth, 31);
32-
assert.sameValue((new Temporal.PlainDateTime(1997, 11, 23, 5, 30, 13)).daysInMonth, 30);
33-
assert.sameValue((new Temporal.PlainDateTime(1997, 12, 23, 5, 30, 13)).daysInMonth, 31);

test/built-ins/Temporal/ZonedDateTime/prototype/daysInMonth/basic.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@ features: [Temporal]
88
---*/
99

1010
const tests = [
11-
[new Temporal.PlainDateTime(1976, 2, 18, 15, 23, 30, 123, 456, 789), 29],
12-
[new Temporal.PlainDateTime(1976, 11, 18, 15, 23, 30, 123, 456, 789), 30],
13-
[new Temporal.PlainDateTime(1976, 12, 18, 15, 23, 30, 123, 456, 789), 31],
14-
[new Temporal.PlainDateTime(1977, 2, 18, 15, 23, 30, 123, 456, 789), 28],
11+
[1976, 2, 18, 29],
12+
[1976, 11, 18, 30],
13+
[1976, 12, 18, 31],
14+
[1977, 2, 18, 28],
15+
[1997, 1, 23, 31],
16+
[1996, 2, 23, 29],
17+
[2000, 2, 23, 29],
18+
[1997, 2, 23, 28],
19+
[1997, 3, 23, 31],
20+
[1997, 4, 23, 30],
21+
[1997, 5, 23, 31],
22+
[1997, 6, 23, 30],
23+
[1997, 7, 23, 31],
24+
[1997, 8, 23, 31],
25+
[1997, 9, 23, 30],
26+
[1997, 10, 23, 31],
27+
[1997, 11, 23, 30],
28+
[1997, 12, 23, 31],
1529
];
16-
for (const [plainDateTime, expected] of tests) {
30+
for (const [y, m, d, expected] of tests) {
31+
const plainDateTime = new Temporal.PlainDateTime(y, m, d, 15, 23, 30, 123, 456, 789);
1732
assert.sameValue(plainDateTime.toZonedDateTime("UTC").daysInMonth, expected, `${expected} days in the month of ${plainDateTime}`);
1833
}
1934

2035

21-
assert.sameValue((new Temporal.PlainDateTime(1997, 1, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 31);
22-
assert.sameValue((new Temporal.PlainDateTime(1996, 2, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 29);
23-
assert.sameValue((new Temporal.PlainDateTime(2000, 2, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 29);
24-
assert.sameValue((new Temporal.PlainDateTime(1997, 2, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 28);
25-
assert.sameValue((new Temporal.PlainDateTime(1997, 3, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 31);
26-
assert.sameValue((new Temporal.PlainDateTime(1997, 4, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 30);
27-
assert.sameValue((new Temporal.PlainDateTime(1997, 5, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 31);
28-
assert.sameValue((new Temporal.PlainDateTime(1997, 6, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 30);
29-
assert.sameValue((new Temporal.PlainDateTime(1997, 7, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 31);
30-
assert.sameValue((new Temporal.PlainDateTime(1997, 8, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 31);
31-
assert.sameValue((new Temporal.PlainDateTime(1997, 9, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 30);
32-
assert.sameValue((new Temporal.PlainDateTime(1997, 10, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 31);
33-
assert.sameValue((new Temporal.PlainDateTime(1997, 11, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 30);
34-
assert.sameValue((new Temporal.PlainDateTime(1997, 12, 23, 5, 30, 13)).toZonedDateTime("UTC").daysInMonth, 31);

0 commit comments

Comments
 (0)