Skip to content

London | 26-ITP-Sep| Mars Adesina | Sprint 1 | formatAs12HourClock - #1640

Open
marscancode wants to merge 6 commits into
CodeYourFuture:mainfrom
marscancode:coursework/sprint-1
Open

marscancode wants to merge 6 commits into
CodeYourFuture:mainfrom
marscancode:coursework/sprint-1

Conversation

@marscancode

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

CYF-1197

Changelist

I added several edge case tests to help me locate the bugs in the original code and after finding out that it failed to convert midnight and minutes after 12, I updated the function so it now passes those same edge cases tests.

@marscancode marscancode added 📅 Sprint 1 Assigned during Sprint 1 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 3, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your function gives the right answer for every valid time I tried, including midnight, noon and the minute either side of each. You also kept the two starter tests exactly as they were, and the code passes Prettier.

Two things before I can mark this Complete:

  1. Nothing tests the 12 o'clock hour yet. See my comment on timeConverter.js line 9.
  2. Some of the edges where am changes to pm, and back, have no test. See my comment on timeConverter.test.js line 17.

The other two comments are smaller: a test name that doesn't match its input, and an optional question about formatting.

Add the Needs Review label again once you've pushed.

Comment thread format-clock-edge-cases/timeConverter.js
Comment thread format-clock-edge-cases/timeConverter.test.js
Comment thread format-clock-edge-cases/timeConverter.test.js Outdated
});

test("can correctly convert hours in the afternoon", function () {
assert.equal(formatAs12HourClock("13:00"), "1:00 pm");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional, not needed for Complete: morning times keep their zero ("08:00 am"), but afternoon times drop it ("1:00 pm"). Which style do you think the function should use? Whichever you pick, it's worth being the same for both.

@abdishakoor-dev abdishakoor-dev added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 5, 2026
@marscancode marscancode added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 5, 2026

@abdishakoor-dev abdishakoor-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new 12:00 test is the one that was missing: if I delete lines 9 and 10 of timeConverter.js, it fails straight away. With 11:59 and 23:59 covered too, that's everything. Marking this Complete, well done.

@abdishakoor-dev abdishakoor-dev added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants