Repository navigation
Manchester | Monsur Abdulrahman | 26-ITP-Sep | Sprint 1 | Format-clock-edge-cases - #1725
Monsur0001 wants to merge 4 commits into
Conversation
hackertainment
left a comment
There was a problem hiding this comment.
The code generally looks ok to me. Just need to fix the missing test case. Thank you, and keep it up.
| return `${hours - 12}:00 pm`; | ||
| const convertedHours = hours - 12; | ||
| // Add leading zero if convertedHours is a single digit | ||
| const formattedHours = convertedHours < 10 ? `0${convertedHours}` : convertedHours; |
There was a problem hiding this comment.
While this produces a correct result, it would be a best practice to assign the same type of data to a variable (rather than leaving it to the JavaScript interpreter for type conversion), i.e. ? `0${convertedHours}` : `convertedHours`; so that both values are of the string type.
There was a problem hiding this comment.
The test cases you have included are:
00:00midnight12:00noon01:30single digit hour in the morning13:45single digit hour in the afternoon23:00double digits hour in the afternoon
It seems that there is still one case missing. Please add it back, thanks a lot.
There was a problem hiding this comment.
Thank you for taking your time to review my code, I have added the "double-digit hour in the afternoon" test case.
There was a problem hiding this comment.
Good try, but please read the list of test cases carefully. Since you already have both single-digit and double-digit hour in the afternoon in your original tests, the one you have missed would not be in the afternoon anyway.
… functions and tests
|
Please refer to my new comment #1725 (comment) , thank you. |
Self checklist
Task code
CYF-1197
Changelist
I suggested edge cases and fixed the code to make sure the test cases pass