File tree Expand file tree Collapse file tree
Sprint-2/5-stretch-extend Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,8 +11,10 @@ function formatAs12HourClock(time) {
1111 if ( hours === 12 ) {
1212 return `12:${ minutes } pm` ;
1313 }
14+
1415 if ( hours > 12 ) {
15- return `${ hours - 12 } :${ minutes } pm` ;
16+ let paddedHours = String ( hours - 12 ) . padStart ( 2 , "0" ) ;
17+ return `${ paddedHours } :${ minutes } pm` ;
1618 }
1719 return `${ time } am` ;
1820}
@@ -52,9 +54,9 @@ console.assert(
5254 `current output: ${ currentOutput5 } , target output: ${ targetOutput5 } `
5355) ;
5456
55- const currentOutput6 = formatAs12HourClock ( "12:45" ) ;
56- const targetOutput6 = "12:45 pm" ;
57+ const currentOutput6 = formatAs12HourClock ( "12:45" ) ;
58+ const targetOutput6 = "12:45 pm" ;
5759console . assert (
5860 currentOutput6 === targetOutput6 ,
5961 `current output: ${ currentOutput6 } , target output: ${ targetOutput6 } `
60- ) ;
62+ ) ;
You can’t perform that action at this time.
0 commit comments