Countdown timer

I have multiple test cases on the same page and those count down per second (as the date time module is set to seconds intervals). It’s just these formatted ones that aren’t counting down live

I don’t see a reason why would they not count down “live” if the datetime component used is set to seconds.

The first one counts down live - the others don’t. I can’t provide any more insight without questions / guidance.

Thanks for your help.

If anyone else has any ideas that would be appreciated.

Can you explain this more detailed? What is the “first one”? What are the others?

I’m referring to my initial post. You can see the first line of code - this counts down fine but is not in the desired format. The others are trial error that end in the desired format but without the live count.

This doesn’t count/show seconds … this counts the minutes. That’s why it doesn’t look like it’s counting. You need to wait like 60 seconds to see it counts.

For seconds you need to also add:

{{(var1.datetime.secondsUntil(end_date)) % 60).floor()}}
1 Like

A list of the different parts up to years:

{{(((var1.datetime.secondsUntil(end_date)) / 31536000)).floor()}}y
{{(((var1.datetime.secondsUntil(end_date))/ 86400)%365).floor()}}d 
{{(((var1.datetime.secondsUntil(end_date)/3600)%24)).floor()}}h 
{{(((var1.datetime.secondsUntil(end_date)/60)%60)).floor()}}m 
{{(((var1.datetime.secondsUntil(end_date)%60))).floor()}}s left

(doesn’t take into account leap years)

2 Likes

Got it! That’s what’s missing then! @Teodorand @bpj I’ll try those thank you!

Thanks @Teodor and @bpj - this resolved it perfectly, thank you both. Much appreciated.

1 Like