Skip to content

Commit cf5075f

Browse files
committed
modified the first confition in the function. include "-"
1 parent 3d03d05 commit cf5075f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function formatAs12HourClock(time) {
22
const hours = Number(time.slice(0, 2));
33
const minutes = time.slice(-2);
44

5-
if (hours > 24 || hours < 0) {
5+
if (hours > 24 || hours < 0 || time.includes("-")) {
66
return "invalid input.";
77
} else if (hours === 24 || hours === 0) {
88
return `${12}:${minutes}am`;

0 commit comments

Comments
 (0)