Lightweight, customizable countdown timer for sales, events, and deadlines. No dependencies, mobile responsive, accessible.
Standard countdown with days, hours, minutes, and seconds.
<div data-tradecalcs-countdown
data-target="2027-01-01T00:00:00"
data-labels="Days,Hours,Minutes,Seconds"
data-complete="Happy New Year 2027!">
</div>
Countdown for a limited-time sale or promotion.
<div data-tradecalcs-countdown
data-target="2026-05-21T10:17:00"
data-labels="Days,Hours,Mins,Secs"
data-complete="Sale Ended!">
</div>
Smaller countdown for sidebars or tight spaces.
<div data-tradecalcs-countdown
data-compact="true"
data-target="2026-06-01T00:00:00"
data-labels="D,H,M,S">
</div>
Customized colors using CSS variables.
<div data-tradecalcs-countdown
data-target="2026-07-04T00:00:00"
style="--tc-countdown-bg: #faf5ff;
--tc-countdown-border: #9333ea;
--tc-countdown-value-color: #7e22ce;">
</div>
Step 1: Add the CSS and JavaScript files to your HTML:
<!-- Add to <head> -->
<link rel="stylesheet" href="/widgets/countdown-timer.css">
<!-- Add before closing </body> -->
<script src="/widgets/countdown-timer.js"></script>
Step 2: Add a countdown to your page:
<div data-tradecalcs-countdown
data-target="2027-01-01T00:00:00"
data-labels="Days,Hours,Minutes,Seconds"
data-complete="Time's up!">
</div>
Note: Replace d790a6cc.tradecalcs.pages.dev with tradecalcs.com once the production domain is configured.
data-target (required) — Target date/time in ISO format (e.g., "2027-01-01T00:00:00")data-labels (optional) — Comma-separated labels for time units (default: "Days,Hours,Minutes,Seconds")data-complete (optional) — Message to show when countdown completes (default: "Time's up!")data-hide-complete (optional) — Set to "false" to show completion message instead of hiding (default: "true")data-compact (optional) — Set to "true" for compact styledata-minimal (optional) — Set to "true" for minimal style (no background/border)--tc-countdown-bg — Background color--tc-countdown-border — Border color--tc-countdown-value-color — Number color--tc-countdown-label-color — Label color--tc-countdown-complete-color — Completion message color--tc-countdown-radius — Border radius--tc-countdown-padding — Container padding--tc-countdown-gap — Gap between time units--tc-countdown-value-size — Number font size--tc-countdown-label-size — Label font size// Initialize all countdowns manually
TradeCalcsCountdown.init();
// Initialize specific countdown
const element = document.querySelector('[data-tradecalcs-countdown]');
TradeCalcsCountdown.initElement(element);
// Stop a countdown
TradeCalcsCountdown.stop(element);
TradeCalcsCountdown.stop('countdown-id');
// Listen for completion
element.addEventListener('tc-countdown-complete', function(e) {
console.log('Countdown completed!', e.detail);
});
Works in all modern browsers:
Our Network
Built by Cali Dream Construction · CSLB #1054602
Need a custom calculator for your trade business? We'll get back to you within 24 hours.