Skip to content

Commit a1a3870

Browse files
committed
format.js
1 parent 6b0f9f4 commit a1a3870

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function formatAs12HourClock(time) {
104104
return `12:${minutes} pm`;
105105
}
106106
if (hours > 12) {
107-
return `${hours - 12}:${minutes} pm`;
107+
return `${String(hours - 12).padStart(2, "0")}:${minutes} pm`;
108108
}
109109

110110

@@ -120,7 +120,7 @@ console.assert(
120120
console.log(formatAs12HourClock("01:00"))
121121

122122
const currentOutput2 = formatAs12HourClock("19:30");
123-
const targetOutput2 = "7:30 pm";
123+
const targetOutput2 = "07:30 pm";
124124

125125
console.assert(
126126
currentOutput2 === targetOutput2,

0 commit comments

Comments
 (0)