Introducing new-js-clock
More than 15 years ago I published a small jQuery plugin called JS-Clock. It was a straightforward widget that rendered a ticking clock into a DOM element — useful, simple, and entirely of its time. It relied on jQuery, had a handful of rough edges around multi-instance support, and was never meaningfully updated after that initial release.
Today that changes. I’m releasing new-js-clock 1.0.0 — a ground-up TypeScript rewrite that keeps the original spirit while leaving every one of its limitations behind. You can see it in action on the demo page.
What’s new in v1.0.0
Here is everything that landed in this release:
- 🔒 TypeScript — Full type safety with comprehensive interfaces throughout the entire codebase.
- 🌐 E2E + Unit Test Suite — Deterministic Jest coverage plus Selenium E2E browser tests, including extended background-tab behavior validation.
- 📦 Zero Dependencies — Pure vanilla JavaScript. No jQuery required.
- 🐛 Bug Fixes — Multi-instance support now works correctly, which was the main issue in v0.8.
- ⚡ Modern API — A clean, intuitive API with proper instance methods on every clock you create.
- 🧪 Fully Tested — 162 deterministic Jest tests with 99.74% line coverage, 99.02% statement coverage, 100% function coverage, and 98.32% branch coverage.
- 🐳 Dockerized E2E Grid — Selenium Grid running headless Chrome, Firefox, and Edge locally and in CI via
pnpm run e2e:docker. - 📱 ES Modules — ES Module imports with tree-shaking support, alongside CommonJS and IIFE bundles.
- 🌍 DST-Aware Timezones — IANA timezone support with automatic daylight saving time handling.
- ⏱️ Stopwatch Mode — A new stopwatch that counts up from 00:00:00.
- 🏁 Lap & Split Times — Record lap times (delta) and split times (cumulative) in stopwatch mode.
- 📊 Best/Worst Lap — Built-in helpers to find the fastest and slowest lap times from a recorded session.
- 🎯 High-Resolution Timing — Lap deltas measured via
performance.now()for sub-millisecond precision.
Installing
npm install new-js-clock
# or
pnpm add new-js-clock It is also available via CDN for direct browser use — check the README for the unpkg and jsDelivr links.
What took so long?
Honestly? Life. The original JS-Clock was written because of a request by my late friend Gustavo Beltrão (a master PHP dev back in the day with whom I had the privilege to work with on more than one occasion) to be used in some enterprise internal dashboards and also in single page websites for events with visitors from different timezones. It did its job well enough that it never felt urgent to revisit. But jQuery has long since faded from modern projects, TypeScript has become the standard for library authorship, and the bug around multi-instance support always nagged at me. When I finally sat down to fix it properly, it made sense to do it right — with types, tests, a proper module system, and enough features to make it genuinely useful in 2026, and I’m planning to use it on my next commercial project.
Better late than never.
To Jesus Christ alone be the glory!