Skip to content

Commit 5f92f70

Browse files
committed
update: correcting padding for hours time
1 parent 61bac86 commit 5f92f70

File tree

1 file changed

+2
-5
lines changed
  • Sprint-1/2-mandatory-errors

1 file changed

+2
-5
lines changed

Sprint-1/2-mandatory-errors/4.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function convertTo12HourClockTime(time24clock) {
1515
hours -= 12; // Convert to 12-hour format
1616
}
1717

18-
return `${hours}:${minutes.toString().padStart(2, "0")} ${modifier}`;
18+
return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")} ${modifier}`;
1919
}
2020
function convertTo24HourClockTime(time12clock) {
2121
let [time, modifier] = time12clock.split(" ");
@@ -31,7 +31,4 @@ function convertTo24HourClockTime(time12clock) {
3131
.toString()
3232
.padStart(2, "0")}`;
3333
}
34-
console.log(convertTo12HourClockTime(twentyFourHourClockTime)); // Output: "08:53 PM"
35-
console.log(convertTo24HourClockTime(twelveHourClockTime)); // Output: "20:53"
36-
// Output: "20:53"
37-
// Output: "08:53 PM"
34+
console.log(convertTo12HourClockTime(twentyFourHourClockTime)); // Output: "08:53 PM"

0 commit comments

Comments
 (0)