Skip to content

Commit e033237

Browse files
committed
NaN error fixed
1 parent 88f7443 commit e033237

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎format-clock-edge-cases/timeConverter.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ function formatAs12HourClock(time) {
1313
timePeriod = "pm";
1414
}
1515
else if (hours < 12) {
16-
hours12 = String(hours12).padStart(2, "0");
16+
hours12 = String(hours).padStart(2, "0");
1717
timePeriod = "am";
1818
}
1919
else if (hours > 12) {
20-
hours12 = String(hours12 - 12).padStart(2, "0");
20+
hours12 = String(hours - 12).padStart(2, "0");
2121
timePeriod = "pm"
2222
}
2323
return `${hours12}:${minutes} ${timePeriod}`

0 commit comments

Comments
 (0)