v2.0.0 - Modular Architecture and User-Customizable Time Formats
Overview
Version 2.0.0 marks a major milestone for the Digital Clock Program, focusing on significant architectural improvements and introducing highly-requested user features. This release refactors the entire codebase into a modular structure for better maintainability and scalability. Highlighting this release is the new ability for users to select their preferred time format (12-hour or 24-hour), with the preference saved across sessions.
Highlights
Time Format Toggle with Preference Persistence, Complete Codebase Modularization, Enhanced User Interface and Styling, and Introduction of Breaking API Changes for a more robust architecture.
New Features
A user-configurable time format toggle has been introduced. Users can now switch between a 12-hour (AM/PM) and a 24-hour clock display. This preference is automatically saved to the browser's local storage, ensuring the user's selection persists on their next visit without requiring any manual setup.
Improvements
The entire JavaScript codebase has been refactored into distinct modules for the clock's core logic (modules/clock/index.js) and user preferences (modules/preferences/index.js). This modular design makes the code cleaner, easier to debug, and more scalable for future development. The styling has been updated to accommodate the new toggle switch, and the main clock element is now enclosed in a semantic <main> tag. Logging has also been enhanced to provide better traceability for the new features.
Breaking Changes
The startClock function is no longer available in the global scope of index.js and has been moved into its own dedicated module at modules/clock/index.js. Any external scripts or custom implementations directly calling this function will need to be updated to import it from the new module. The primary clock container has been changed from a div element to a main element, which may affect custom CSS or JavaScript selectors targeting the previous div#clock-box ID. The export method for the logging module has also been updated, which could affect certain module resolution setups.
Upgrade Guide
Docker Users
To upgrade to the latest version, pull the new v2.0.0 or latest tag from Docker Hub:
docker pull amnoorbrar/digital-clock
docker run --rm -p 8080:80 amnoorbrar/digital-clockBuilding from Source
To build this version from the source code:
git clone https://github.com/Amnoor/Digital-Clock-Program.git
cd Digital-Clock-Program
git checkout v2.0.0
docker build -t digital-clock .
docker run --rm -p 8080:80 digital-clockFiles Modified
- .github (Folder, Unchanged):
- workflows (Folder, Unchanged):
- docker-push.yml (File, Unchanged)
- workflows (Folder, Unchanged):
- assets (Folder, Unchanged):
- background.jpg (File, Unchanged)
- clock-icon.svg (File, Modified)
- modules (Folder, Modified):
- clock (Folder, Added):
- index.js (File, Added)
- logs (Folder, Modified):
- index.js (File, Modified)
- prefer ences (Folder, Added):
- index.js (File, Added)
- clock (Folder, Added):
- style (Folder, Unchanged):
- style.css (File, Modified)
- .dockerignore (File, Modified)
- CONTIBUTING.md (File, Unchanged)
- Dockerfile (File, Unchanged)
- index.html (File, Modified)
- index.js (File, Modified)
- LICENSE (File, Unchanged)
- README.md (File, Unchanged)
Verification
This release has been successfully tested for the following:
- Correct functionality of the 12-hour and 24-hour time format toggle.
- Successful persistence and loading of user preferences from local storage.
- Integrity of the modularized codebase and all import/export paths.
- Continued core clock functionality without regressions after the refactor.
Links
- Repository: Digital Clock Program v2.0.0 (https://github.com/Amnoor/Digital-Clock-Program/tree/v2.0.0)
- Docker Hub: amnoorbrar/digital-clock (https://hub.docker.com/r/amnoorbrar/digital-clock)
- Changelog:
Contributors
- Amnoor Brar - Project Owner & Lead Developer
Full Changelog: