Pulse CountdownBack to the demo

Documentation

Version 1.0.0 - plain JavaScript, no dependencies, no build step.

What it is

Pulse Countdown renders a countdown timer into any element on a page. It runs three kinds of timer: a fixed date, an evergreen timer that gives every visitor their own countdown, and a recurring timer that counts to the next daily, weekly or monthly occurrence. It is one JavaScript file and one stylesheet, with no dependencies and no network requests.

Install

  1. Copy pulse.js and pulse.css into your project.
  2. Add an element where the timer should appear.
  3. Load the stylesheet, load the script, then call Pulse.create.
<link rel="stylesheet" href="pulse.css">

<div id="launch-timer"></div>

<script src="pulse.js"></script>
<script>
  Pulse.create("#launch-timer", {
    mode: "fixed",
    target: "2026-12-31T23:59:00Z",
    theme: "midnight",
    size: "md"
  });
</script>

The same two files work from a CDN path, from a bundler, or from a plain folder. If you use a module bundler, pulse.js also exports through CommonJS.

The three modes

Fixed date

Counts down to one moment in time. The target is an ISO 8601 string, ideally with an explicit offset or a trailing Z so every visitor counts to the same instant.

Pulse.create("#t", { mode: "fixed", target: "2026-12-31T23:59:00Z" });

Evergreen

Gives each visitor a countdown of their own, starting the first time they see it. The start time is stored in localStorage under the instance's storage key, so a refresh does not restart it. Use this for offers that should always look like they are about to end.

Pulse.create("#t", {
  mode: "evergreen",
  duration: 86400,          // seconds
  storageKey: "black-friday-2026"
});

Duration is in seconds. If a visitor clears site data, or opens the page in a private window, their countdown starts again.

Recurring

Counts to the next occurrence of a daily, weekly or monthly moment, then rolls over to the following one without a reload.

Pulse.create("#t", {
  mode: "recurring",
  recurring: { every: "week", weekday: 1, time: "18:00" },
  timezone: "Africa/Cairo"
});
FieldMeaning
every"day", "week" or "month".
weekday0 to 6, Sunday to Saturday. Used when every is "week".
day1 to 31. Used when every is "month". Months without that day are skipped.
time"HH:MM" in 24-hour form, in the chosen timezone.

Timezones

Set timezone to "auto" (the default) and the timer uses the visitor's own timezone. Set it to an IANA name such as "Europe/London" and every visitor sees the same wall-clock moment, converted correctly across daylight saving changes. Recurring timers are computed in the chosen timezone, not the server's.

Options

OptionDefaultWhat it does
mode"fixed""fixed", "evergreen" or "recurring".
targetnullISO date string or a Date. Required in fixed mode.
duration86400Length in seconds for evergreen mode.
recurringnullObject described above. Required in recurring mode.
timezone"auto""auto" or an IANA timezone name.
units["days","hours","minutes","seconds"]Which units to show, in order. Drop "days" for a short timer.
labelsnullOverride any unit label, for example { days: "D", seconds: "S" }.
theme"midnight"midnight, aurora, paper, sunset, mint or mono.
size"md"sm, md or lg.
padtruePads hours, minutes and seconds to two digits.
doneText"Finished"Text shown at zero. Set to an empty string to show nothing.
hideWhenDonefalseHides the whole timer at zero instead of showing doneText.
storageKeyone per elementlocalStorage key used by evergreen mode. Set it to keep the same countdown across pages.
onCompletenullFunction called once when the timer reaches zero.
onTicknullFunction called on every update with the parts object.

Methods

MethodWhat it does
instance.set(key, value)Changes one option and recomputes the deadline.
instance.stop()Stops the update loop.
instance.start()Restarts it.
instance.render()Repaints immediately.
instance.destroy()Stops the loop and empties the element.
var timer = Pulse.create("#t", { mode: "evergreen", duration: 3600 });
timer.set("theme", "sunset");
timer.set("duration", 7200);

Styling

Themes are sets of CSS custom properties. To retune a theme without writing a new one, override the variables on the container:

#launch-timer {
  --pulse-bg: #ffffff;
  --pulse-fg: #111827;
  --pulse-muted: #6b7280;
  --pulse-accent: #2563eb;
  --pulse-radius: 10px;
  --pulse-value-size: 40px;
}

The available variables are --pulse-bg, --pulse-fg, --pulse-muted, --pulse-accent, --pulse-radius, --pulse-gap, --pulse-value-size, --pulse-label-size and --pulse-pad. Each part also carries a .pulse__part--days style class, so a single unit can be styled on its own.

WordPress

Upload pulse.js and pulse.css to your theme or child theme, enqueue them, and drop the container into any page or post. A shortcode keeps the content editable:

// functions.php
function pulse_assets() {
  wp_enqueue_style('pulse', get_stylesheet_directory_uri() . '/pulse/pulse.css');
  wp_enqueue_script('pulse', get_stylesheet_directory_uri() . '/pulse/pulse.js', array(), '1.0.0', true);
}
add_action('wp_enqueue_scripts', 'pulse_assets');

function pulse_shortcode($atts) {
  $a = shortcode_atts(array('target' => '', 'theme' => 'midnight'), $atts);
  $id = 'pulse-' . wp_rand(1000, 9999);
  $js = sprintf(
    'Pulse.create("#%s", {mode:"fixed", target:"%s", theme:"%s"});',
    $id, esc_js($a['target']), esc_js($a['theme'])
  );
  return sprintf('<div id="%s"></div><script>%s</script>', $id, $js);
}
add_shortcode('pulse', 'pulse_shortcode');

Then use [pulse target="2026-12-31T23:59:00Z" theme="paper"] in the editor. If your site caches pages, the fixed mode is the safe choice, because evergreen and recurring timers are computed in the browser.

Shopify, Webflow and other builders

Upload the two files to your theme assets, include them, and paste the container plus the Pulse.create call into a custom HTML block. Nothing in the script depends on a framework, so it behaves the same inside a builder as it does on a plain page.

Accessibility

The container is marked role="timer" with aria-live="polite", and the numbers are written as text rather than images, so screen readers announce the remaining time. If you use a very short interval or a decorative timer, consider aria-live="off" on the container to avoid constant announcements.

Browser support

Every current version of Chrome, Edge, Firefox and Safari, plus iOS Safari 15 and later. The script uses Intl.DateTimeFormat for timezone maths and localStorage for evergreen mode; both are available everywhere the timer is supported.

Notes and limits

Changelog

1.0.0 - first release: fixed, evergreen and recurring modes; timezone-aware maths; six themes; three sizes; unit and label control; complete and tick callbacks; WordPress shortcode example; documentation.