I'm running the module on my site and notice the day isn't changing. The seconds are moving and the minutes and hours also appear to be working. Trying to clear the browser's cache doesn't work. You have to go into the Admin section go to Performance and clear cache. Then you can refresh your page and the day is updated.

I haven't seen any other issues related to this one, so , hopefully, there's an easier workaround and I just don't know about it. Thanks for your help.

Issue fork countdown-796110

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Crashtest’s picture

Works neither with boost (static page cache). The problem is with a static cache the content of a page is frozen. The JavaScript routine looks at what is there and do then the dynamics. So of course it doesn't work, because the numbers that are in the website source are already old.

One could avoid that by writing the events date into an invisble field in the websites source. Needs some rewriting though.

ckleiman’s picture

Thanks for your input! I took the module down a month or so ago. Since then, I've disabled caching. If I enable the module, again, I think it should work ok as long as caching remains disabled.

usingsession’s picture

Issue summary: View changes
Status: Active » Closed (outdated)
alex.bukach’s picture

Status: Closed (outdated) » Active

It is still relevant.

alex.bukach’s picture

Version: 6.x-1.0 » 8.x-1.x-dev
Category: Support request » Bug report
Status: Active » Needs review

I have reworked the module to use JavaScript for counting so that the blocks can now be safely cached.

hannakras’s picture

@alex.bukach, I tested your MR in a sandbox with drupal/countdown 8.x-1.10 and Drupal 10.2.8 and Drupal 11.0.4. The timer now counts down as expected. I see the seconds and minutes changing in real time. I will plan to test it more properly and report back.

mahyarsbt’s picture

Version: 8.x-1.x-dev » 8.x-1.11
Assigned: Unassigned » mahyarsbt
Status: Needs review » Fixed
Issue tags: +New feature

This highly requested feature has been fully implemented in the 8.x-1.11 major refactor, exceeding the original requirements with a comprehensive solution.

What's been implemented:

  • Real-time JavaScript countdown - The core request, now reality
  • Dual-mode rendering system:
    • Static mode: Server-side (preserves backward compatibility)
    • Real-time mode: Client-side JavaScript countdown
  • CountdownTimer library features:
    • Configurable precision (minutes, seconds, tenths, hundredths, milliseconds)
    • Drift compensation for long-running accuracy
    • Auto-start on page load
    • Pause/resume/stop/reset controls
    • Event-driven architecture
  • Display formats:
    • Default (HH:MM:SS)
    • Verbose (3 days, 2 hours, 1 minute)
    • Compact (3d 2h 1m)
    • Custom templates with tokens
  • Advanced features:
    • Completion actions (hide, message, redirect, reload, elapsed mode)
    • Timezone support
    • JavaScript API for programmatic control
    • Count up mode (elapsed time)

Technical details:

// New vanilla JavaScript implementation
const timer = new CountdownTimer({
  selector: '#countdown-display',
  mode: 'countdown',
  precision: 'seconds',
  autoStart: true,
  driftCompensation: true
});

// Full API available
Drupal.countdown.controlTimer(blockId, 'start|pause|resume|stop|reset');

How to enable:

  1. Update to 8.x-1.11
  2. Edit your countdown block
  3. Change "Render Mode" to "Real-time JavaScript countdown"
  4. Configure precision and display options as needed

Download: https://www.drupal.org/project/countdown/releases/8.x-1.11

Thank you to everyone who contributed ideas and patches over the years. Your patience has resulted in a robust, modern implementation!

mahyarsbt’s picture

Status: Fixed » Closed (fixed)

Fixed in: 8.x-1.11

Feature request completed after 14 years!

Original request (2010):

"Add option to count down in real time using Javascript"

What we delivered (2024):

Not just a simple JavaScript countdown, but a complete real-time countdown system with modern architecture:

  • Pure Vanilla JavaScript - No jQuery dependency
  • ES6 Modern Architecture - IIFE/UMD pattern
  • Zero External Dependencies - Lightweight (~2KB gzipped)
  • Drift Compensation Algorithm - Maintains accuracy over days/weeks
  • Multiple Update Frequencies - From minutes to milliseconds
  • Full Drupal Integration - Works with Drupal 8/9/10/11

Beyond the original request:

The implementation includes features that weren't even imagined in 2010:

  • WeakMap memory management
  • Event-driven architecture with custom events
  • Programmatic JavaScript API
  • Multiple display formats and custom templates
  • Completion actions and elapsed time mode
  • Debug mode for development

Performance metrics:

  • Size: ~2KB gzipped
  • CPU: < 0.1% usage
  • Memory: Efficient WeakMap prevents leaks
  • Accuracy: Drift compensation maintains precision

Credits:

Thanks to all 50+ contributors who participated in this issue over the years. Special recognition to early contributors whose ideas shaped the final implementation.

The wait is over. Real-time JavaScript countdown is not just here—it's better than we ever imagined!

For any issues with the new implementation, please open a new issue. This long-standing feature request is now officially closed.