Save 36% for Black Friday! Learn more

All threads / How to create a live countdown clock?
Ask A Question


You’re not receiving notifications from this thread.

How to create a live countdown clock?

Thomas Van Holder asked in General

Hi all,

We're creating an online auction which has a countdown clock on the show page of a listing.
The timer counts down every second, just like this example:
I've been looking at Stimulus Reflex, classic JS and action cable.
What's the best way to build this with rails?

Thanks for your feedback.

Hi Thomas,

I'm looking to do the same, did you find a solution?

Hi Samuel,

I've ended up using vanilla JS. However, you could do the same with Stimulus, that's what I would do when rebuilding it.

Here's roughly the outline of the code that was used.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 67,819+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.