File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Sprint-2/5-stretch-extend Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 55function formatAs12HourClock ( time ) {
66 const hours = Number ( time . slice ( 0 , 2 ) ) ;
77 const minutes = time . slice ( 3 , 5 )
8- if ( hours < 1 ) {
8+ if ( hours === 0 ) {
99 return `12:${ minutes } am`
1010 }
11- if ( hours == 12 && minutes == 00 ) {
12- return "12:00 pm"
11+ if ( hours === 12 ) {
12+ return ` ${ hours } : ${ minutes } pm`
1313 }
1414 if ( hours > 12 ) {
1515 return `${ hours - 12 } :${ minutes } pm` ;
@@ -52,8 +52,8 @@ console.assert(
5252 `current output: ${ currentOutput5 } , target output: ${ targetOutput5 } `
5353) ;
5454
55- const currentOutput6 = formatAs12HourClock ( "12:00 " ) ;
56- const targetOutput6 = "12:00 pm" ;
55+ const currentOutput6 = formatAs12HourClock ( "12:59 " ) ;
56+ const targetOutput6 = "12:59 pm" ;
5757console . assert (
5858 currentOutput6 === targetOutput6 ,
5959 `current output: ${ currentOutput6 } , target output: ${ targetOutput6 } `
You can’t perform that action at this time.
0 commit comments