Skip to content

Commit bc7784e

Browse files
committed
used the padstart method on the edge case so the numbers should always be two digits for consistency code.
1 parent dd75584 commit bc7784e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function formatAs12HourClock(time) {
1515
}
1616

1717
if (hours > 12) {
18-
return `${hours - 12}:${minutes} pm`;
18+
return `${String(hours - 12).padStart(2, "0")}:${minutes} pm`;
1919
}
2020

2121
return `${time} am`;

0 commit comments

Comments
 (0)