Skip to content

London|26-ITP-Sep|Rhoda Ajiroba|Sprint 1|Exhaustively test and fix formatAs12HourClock - #1659

Open
codebyra wants to merge 1 commit into
CodeYourFuture:mainfrom
codebyra:coursework/format-clock-edge-cases
Open

codebyra wants to merge 1 commit into
CodeYourFuture:mainfrom
codebyra:coursework/format-clock-edge-cases

Conversation

@codebyra

@codebyra codebyra commented Oct 8, 2026

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

Task code

CYF-1197

Changelist

Fixed bugs in the formatAs12HourClock function to correctly handle midnight, noon, AM/PM conversions, and minutes. Added 16 tests covering various edge cases, all passing successfully.

@codebyra codebyra added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 8, 2026

@Luro91 Luro91 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Well done the code works correctly and the tests cover the edge cases

export {formatAs12HourClock};
const formattedHours = String(hours12).padStart(2, "0");

return `${formattedHours}${minutes} ${period}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice use of helper variables. This makes this line easy to read and understand (because the calculations and formatting is happening before)

@Luro91 Luro91 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 8, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants