Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Refactoring & Bug Fixes for Clock and Alarm System in Digital Clock #712

Open
Amansingh0807 opened this issue Feb 10, 2025 · 1 comment

Comments

@Amansingh0807
Copy link

The current clock and alarm system has several issues, including syntax errors, inconsistent time formatting, and redundant code. Additionally, the alarm triggers multiple times within the same minute, causing unexpected behavior.

Bugs & Issues Identified:

  • Syntax error: Extra parenthesis in setInterval call.
  • Inconsistent time formatting with leading zeros.
  • Alarm triggers multiple times instead of once per set time.
  • Potential null error when timezone is not selected.
  • Redundant class assignment logic for display elements.

Fixes Implemented:

  • Corrected syntax for setInterval.
  • Improved time formatting using padStart().
  • Alarm now triggers only once per minute using startsWith().
  • Added safe checks to prevent null reference errors.
  • Simplified redundant class handling with forEach loop.
Copy link
Contributor

Thank you for raising this issue! We'll look into it as soon as possible. Please ensure that the issue is not duplicate, and you read CONTRIBUTING.md carefully. Your contributions are highly appreciated! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant