We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4d85df1 commit dcb29c3Copy full SHA for dcb29c3
1 file changed
Sprint-2/5-stretch-extend/format-time.js
@@ -8,7 +8,7 @@ function formatAs12HourClock(time) {
8
const hours = Number(time.slice(0, 2));
9
const minutes = time.slice(3, 5);
10
11
- if (hours === 0) {
+ if (hours === 0 || hours === 24) {
12
return `12:${minutes} am`;
13
}
14
else if (hours > 12) {
@@ -47,4 +47,11 @@ const targetOutput4 = "12:00 pm";
47
console.assert(
48
currentOutput4 === targetOutput4,
49
`current output: ${currentOutput4}, target output: ${targetOutput4}`
50
+);
51
+
52
+const currentOutput5 = formatAs12HourClock("24:00");
53
+const targetOutput5 = "12:00 am";
54
+console.assert(
55
+ currentOutput5 === targetOutput5,
56
+ `current output: ${currentOutput5}, target output: ${targetOutput5}`
57
);
0 commit comments