Skip to content

Cape Town | 26-ITP-Sept | Vaidah Simenti | Sprint 1 | coursework/format-clock-edge-cases - #1644

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

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

Conversation

@Vaidah-dev

Copy link
Copy Markdown

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

Added tests for edge cases to timeConverter.test.js
Fixed formatAs12HourClock to handle: Midnight and Noon.
Fixed afternoon time padding and minute.
All tests pass.

@Vaidah-dev Vaidah-dev added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 4, 2026

@cjyuan cjyuan 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.

Implementation and tests are good. Well done.

function formatAs12HourClock(time) {

const hours = Number(time.slice(0, 2));
const minutes = time.slice(3, 5);

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.

Note: The .slice() method supports negative indices, which count positions from the end of the string.
For example, str.slice(-3) returns the substring containing last three characters from str.

@cjyuan cjyuan 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 5, 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