Ask A Question

Notifications

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: https://countingdownto.com/
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.

Reply

Hi Thomas,

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

Reply

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.
https://gist.github.com/thomasvanholder/1778df30141e4c47362102518930c043

Reply
Join the discussion
Create an account Log in

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

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

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