Skip to content

Commit 773c6bc

Browse files
author
AlanGit-debug2604
committed
format-time.js edited to run const minutes =time.slice(-2); and fixed if (hours >= 24) (previous >24)
1 parent b8dc470 commit 773c6bc

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
@@ -4,8 +4,8 @@
44

55
function formatAs12HourClock(time) {
66
const hours = Number(time.slice(0, 2));
7-
const minutes = time.slice(3);
8-
if (hours > 24) {
7+
const minutes = time.slice(-2);
8+
if (hours >= 24) {
99
return `${hours - 24}:${minutes} am +1`;
1010
} else if (hours > 12) {
1111
return `${hours - 12}:${minutes} pm`;

0 commit comments

Comments
 (0)