Skip to content

Commit 7c6f884

Browse files
authored
Fix AM time formatting for hours less than 12
1 parent 2176535 commit 7c6f884

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Sprint-2/5-stretch-extend/format-time.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ console.assert(
3131
const minutes = time.slice(3, 5);
3232

3333
if (hours == 0) return `12:${minutes} am`;
34-
if (hours < 12) return `${time} am`;
34+
if (hours < 12) return `${hours}:${minutes} am`;
3535
if (hours === 12) return `${time} pm`;
3636

3737
return `${hours - 12}:${minutes} pm`;
@@ -73,4 +73,4 @@ console.assert(formatAs12HourClock("12:00") === "12:00 pm");
7373

7474
// The test passed, so my function gave the expected results.
7575
// All the console.assert() tests passed.
76-
// formatAs12HourClock() function works correctly for the inputs I tested.
76+
// formatAs12HourClock() function works correctly for the inputs I tested.

0 commit comments

Comments
 (0)