Skip to content

Cape Town | 26-ITP-Sept | Edward Kganyago | Sprint 2 | Time Converter - #1664

Open
edwardkganyago45-source wants to merge 2 commits into
CodeYourFuture:mainfrom
edwardkganyago45-source:Structuring-and-Testing-Data
Open

edwardkganyago45-source wants to merge 2 commits into
CodeYourFuture:mainfrom
edwardkganyago45-source:Structuring-and-Testing-Data

Conversation

@edwardkganyago45-source

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 the time converter and tested edge cases

@edwardkganyago45-source edwardkganyago45-source added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 8, 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.

Test cases are good.

Note: I think this exercise is Sprint 1.

Comment on lines +2 to +4
const [hoursStr, minutesStr] = time.split(":");
const hours = Number(hoursStr);
const minutes = minutesStr ?? "00";

@cjyuan cjyuan Oct 9, 2026 •

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.

Could you walk me through how minutesStr ?? "00" is evaluated?

You probably overlooked how ?? works.

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.

The first expression preserves the empty string; the second replaces it

@cjyuan cjyuan Oct 9, 2026 •

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.

How could minutesStr be an empty string? How is the code on line 4 different from

  const minutes = minutesStr;

@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 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants