Skip to content

Commit 09748a1

Browse files
committed
modifed the code of else.
1 parent 6836eaa commit 09748a1

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ function formatAs12HourClock(time) {
1111
} else if (hours > 12) {
1212
return `${hours - 12}:${minutes} pm`;
1313
} else {
14-
return `${hours}:${minutes} am`;
14+
return `${time.slice(0, 2)}:${minutes} am`;
1515
}
1616
}
1717

1818
export { formatAs12HourClock };
19+
20+
console.log(formatAs12HourClock("08:00"))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ test("correctly convert time afternoon time: 23:00", function () {
77
});
88

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

1313
test("can correctly convert morning time 11:59", function () {

0 commit comments

Comments
 (0)