Skip to content

London | 26-ITP-Jan | Kris Oldrini | Sprint 3 | Alarm Clock App#1208

Open
XiaoQuark wants to merge 7 commits intoCodeYourFuture:mainfrom
XiaoQuark:49-build-an-alarm-clock-app
Open

London | 26-ITP-Jan | Kris Oldrini | Sprint 3 | Alarm Clock App#1208
XiaoQuark wants to merge 7 commits intoCodeYourFuture:mainfrom
XiaoQuark:49-build-an-alarm-clock-app

Conversation

@XiaoQuark
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

Changelist

HTML

  • Changed title to "Alarm clock app"

Script

  • Implemented setAlarm() function to display the inputted time in the UI
  • Created formatTime() to convert seconds into MM:SS format
  • Store the time inside state, for easier access across functions
  • Implemented timer() function, using setInterval(), that decreases the time every 1000 millisecond
  • Triggered playAlarm() when the countdown reaches 00:00
  • Ensured the display correctly shows 00:00 when the alarm triggers
  • Prevented multiple intervals by clearing any existing timer before starting a new one

Test

  • Manually tested functionality in the browser
  • Run and passed all Jest tests

Extra Tasks

  • Changed background colour when the alarm triggers
  • Reset background colour when alarm is stopped

@XiaoQuark XiaoQuark added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 20, 2026
Copy link
Copy Markdown

@A-O-Emmanuel A-O-Emmanuel left a comment

Choose a reason for hiding this comment

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

This is a good attempt, but i noticed the following things:

  1. When I click the set alarm button the timer starts counting backwards.
  2. The inpput field accepts negative numbers.

@A-O-Emmanuel A-O-Emmanuel added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. 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. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Apr 20, 2026
@XiaoQuark
Copy link
Copy Markdown
Author

@A-O-Emmanuel

Thank you for the feedback. I implemented input validation so so the timer only accepts positive integers, and cannot count below 00:00. I also added a small inline error message for invalid inputs.

@XiaoQuark XiaoQuark added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants