Skip to content

Manchester | 26-ITP-Sep | Precious Moses | Sprint 3 | Todo list - #1523

Open
moses77-boop wants to merge 27 commits into
CodeYourFuture:mainfrom
moses77-boop:Sprint-3-todo-list
Open

moses77-boop wants to merge 27 commits into
CodeYourFuture:mainfrom
moses77-boop:Sprint-3-todo-list

Conversation

@moses77-boop

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-1097

Changelist

This PR contains a todo-list app built using HTML, CSS and JavaScript.
I implemented functions, wrote tests, and refactored codes where applicable.

@moses77-boop moses77-boop added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. labels Nov 13, 2026
@LonMcGregor LonMcGregor added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 16, 2026
export function daysLeft(deadline, today = new Date()) {
const [year, month, day] = deadline.split("-").map(Number);
const deadlineDate = new Date(year, month - 1, day);
const todaysDate = new Date(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What does daysLeft return for a date like 2026-02-31, and how does that affect the Invalid date check in describeDeadline?

To "like" or "dislike" this comment, please follow this link

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.

For date: 2026-02-31, daysLeft would return -258.
Invalid date only activates when days is NaN, since there is no 31 February, it fails silently.

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 refactored my code to handle invalid dates and added a test for it.


if (Number.isNaN(days)) return "Invalid date";
if (days < 0) return `Overdue by ${-days} days${days === -1 ? "" : "s"}`;
if (days === 0) return "Due today";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What text does this branch produce when a deadline was yesterday?

To "like" or "dislike" this comment, please follow this link

@moses77-boop moses77-boop Nov 16, 2026 •

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.

It returns Overdue by 1 day.
The template string ${ days === -1 ? " : "s" } is a plural checker.

id="new-task-input"
placeholder="Enter a new task..."
/>
<input type="date" id="new-task-deadline" />

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What accessible name does this new date input expose to someone using a screen reader?

To "like" or "dislike" this comment, please follow this link

@moses77-boop moses77-boop Nov 16, 2026 •

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.

It exposes nothing as the date input has no accessible name, so a screen reader only announces its type without saying what the field is for.

@cyf-ai-code-reviewer cyf-ai-code-reviewer Bot 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 Nov 16, 2026
@cyf-ai-code-reviewer

Copy link
Copy Markdown

The CYF AI review has left comments. It will only review a PR one time. When you have addressed these comments, please request review again and a volunteer will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Groups The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants