Skip to content

Commit 6836eaa

Browse files
committed
modified the format of the result. Corrected then typo in test.
1 parent 23c127d commit 6836eaa

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎format-clock-edge-cases/timeConverter.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ function formatAs12HourClock(time) {
55
if (hours > 24 || hours < 0 || time.includes("-")) {
66
return "invalid input.";
77
} else if (hours === 24 || hours === 0) {
8-
return `${12}:${minutes}am`;
8+
return `${12}:${minutes} am`;
99
} else if (hours === 12) {
10-
return `${hours}:${minutes}pm`;
10+
return `${hours}:${minutes} pm`;
1111
} else if (hours > 12) {
12-
return `${hours - 12}:${minutes}pm`;
12+
return `${hours - 12}:${minutes} pm`;
1313
} else {
14-
return `${hours}:${minutes}am`;
14+
return `${hours}:${minutes} am`;
1515
}
1616
}
1717

‎format-clock-edge-cases/timeConverter.test.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ import assert from "node:assert";
33
import test from "node:test";
44

55
test("correctly convert time afternoon time: 23:00", function () {
6-
assert.equal(formatAs12HourClock("23:00"), "11:00pm");
6+
assert.equal(formatAs12HourClock("23:00"), "11:00 pm");
77
});
88

99
test("can correctly convert morning time 08:00", function () {
10-
assert.equal(formatAs12HourClock("08:00"), "8:00am");
10+
assert.equal(formatAs12HourClock("08:00"), "8:00 am");
1111
});
1212

1313
test("can correctly convert morning time 11:59", function () {
14-
assert.equal(formatAs12HourClock("11:59"), "11:59am");
14+
assert.equal(formatAs12HourClock("11:59"), "11:59 am");
1515
});
1616

1717
test("can correctly convert afternoon time 23:59", function () {
18-
assert.equal(formatAs12HourClock("23:159"), "11:59pm");
18+
assert.equal(formatAs12HourClock("23:59"), "11:59 pm");
1919
});
2020

2121
test("can correctly convert morning time 00:00", function () {
22-
assert.equal(formatAs12HourClock("00:00"), "12:00am");
22+
assert.equal(formatAs12HourClock("00:00"), "12:00 am");
2323
});
2424

2525
test("can correctly convert afternoon time 12:00", function () {
26-
assert.equal(formatAs12HourClock("12:00"), "12:00pm");
26+
assert.equal(formatAs12HourClock("12:00"), "12:00 pm");
2727
});

0 commit comments

Comments
 (0)