Repository navigation
Manchester | Monsur Abdulrahman | 26-ITP-Sep | Sprint 1 | Format-clock-edge-cases - #1725
Open
Monsur0001 wants to merge 3 commits into
Open
Monsur0001 wants to merge 3 commits into
Monsur0001 wants to merge 3 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Self checklist
Task code
CYF-1197
Changelist
I suggested edge cases and fixed the code to make sure the test cases pass