Skip to content

Commit a39d35b

Browse files
Fix formatAs12HourClock logic in Sprint 3
1 parent 0f1d3d0 commit a39d35b

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎Sprint-3/5-stretch-extend/format-time.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ function formatAs12HourClock(time) {
88

99
if (hours === 0) {
1010
return `12:${minutes} am`;
11-
}
12-
if (hours === 12) {
11+
} else if (hours === 12) {
1312
return `12:${minutes} pm`;
14-
}
15-
if (hours > 12) {
13+
} else if (hours > 12) {
1614
return `${hours - 12}:${minutes} pm`;
15+
} else {
16+
return `${hours}:${minutes} am`;
1717
}
18-
return `${time} am`;
1918
}
2019

2120
// Original tests

0 commit comments

Comments
 (0)