Skip to content

Manchester | 26-ITP-Sep | Mathew Shaibu | Sprint 1 | Structuring and testing data - #1635

Open
MattCarolus10 wants to merge 11 commits into
CodeYourFuture:mainfrom
MattCarolus10:Structuring-and-testing-data
Open

MattCarolus10 wants to merge 11 commits into
CodeYourFuture:mainfrom
MattCarolus10:Structuring-and-testing-data

Conversation

@MattCarolus10

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

  • Tested for all 24 hours time
  • Tested for all minutes
  • Fixed the bug for 12:00 (noon), now returns 12:00pm instead of 12:00am
  • Fixed the bug for minutes, 12:30 now keeps its minutes returning 12:30pm
  • 13:30 now keeps it's minutes, returning 1:30pm
  • 00:00 (mid-night) now returns 12:00am
  • All test checked and passed

@github-actions

This comment has been minimized.

@MattCarolus10 MattCarolus10 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 3, 2026
@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 3, 2026
@github-actions

This comment has been minimized.

@MattCarolus10 MattCarolus10 changed the title Manchester | 26-ITP-Sep | Mathew Shaibu | Sprint-1 | Structuring and testing data Manchester | 26-ITP-Sep | Mathew Shaibu | Sprint 1 | Structuring and testing data Oct 3, 2026
@MattCarolus10 MattCarolus10 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 3, 2026
Comment thread format-clock-edge-cases/timeConverter.js
Comment thread format-clock-edge-cases/timeConverter.test.js
@cjyuan cjyuan 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 4, 2026
@MattCarolus10 MattCarolus10 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.

Changes look good.

function formatAs12HourClock(time) {

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

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Is this an error that needs to be fixed, I thought negative values don't make a real time.

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.

I think you misunderstood my comment.

return `${time} am`;
return `${time}am`;
}
console.log(formatAs12HourClock("14:00"));

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: To keep the codebase clean, best practice is to ensure code submitted to a PR free of unused code (including debugging code).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have removed the unwanted line of codes. Thank you

@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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 4, 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