Repository navigation
Manchester | 26-ITP-Sep | Precious Moses | Sprint 3 | Todo list - #1523
moses77-boop wants to merge 27 commits into
Conversation
| 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( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
What text does this branch produce when a deadline was yesterday?
To "like" or "dislike" this comment, please follow this link
There was a problem hiding this comment.
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" /> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
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. |
Self checklist
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.