Forum Academy Marketplace Showcase Pricing Features

Realtime update

Hello

I have made a auction website. I need to update the remaining time of each auction
I have calculated the time as:


How do i update the seconds to change in realtime? So user can see exactly the remaining time

Hey dude,

I’ve made a simple timer that counts down based on Input Taken.

On the frontend, you have an input box and a “Start Timer” button.

When a user clicks “Start Timer”, a new field “seconds” is created taking input from the previous page as the value. I send the “seconds” value through to the next page.

On the next page, I show the “seconds” value and create a workflow for it.

The workflow takes away 1 from the “seconds” value every 1 second when the “seconds” field is visible (which it always will be).

It works on the public app so take a look here:

@kfhwdd thank your for your answer.
i have tried it but it’s not accurate . Seconds are not real seconds.
Please check yours aswell, it’s delay between the seconds
What other options do we havE?

1 Like

@emmanuel can you help us? what to do in this situation?

iFrame it in.

Code from here …

http://www.timeanddate.com/clocks/freecountdown.html

1 Like

sorry for making 2 threads.
Is it possible for you to allow access to app, so i can see how to set it up?
Thank you

Yes, of course.

You should be able to use a dynamic field in the HTML to vary the countdown from Bubble data.

1 Like

i don t understand how to use this in my app.
My app works like that:

User creates an auction here: http://bidy.dk/version-test/new-ad
User can set how long the auction should run (i would prefer to use a slider to input the duration of the auction but i don’t know how)
the auction is live and the time i calculate in this way:
AuctionExpirationDate - CurrentTimestampsNow. = Remaining time
My problem is, how can i display this remaining time to user in real time. Everything works, it’s just a matter of display it to user

So you can add a slider that increments the time remaining …

And then add that into the HTML in the iFrame,

1 Like

@NigelG
So now i have the remaining seconds in field x. It updates everytime i refresh the page.
I have tried to use the countdown like this:


i just copied the code you use in your example and replaced the dynamic data with my own. I get this:

What do you think that is the issue?
Regards Claudiu

If you look at the code that is copied you can see the format that the date and time should be in. The time goes after the T. Not before

@NigelG i managed to do something .Thank you
But THIS is weird.
If you open the same page http://bidy.dk/version-test/auction in different browsers, the auction time is different. Do you have any idea why and maybe a fix to this or is it even possible?
The idea is that, if a user from any part of the world will create an auction, and setup 3 hour validity, this will be visible to any user from the world as 3 hours. is it possible?
Thank you so much for your time

I’m thining at something.
Lets say that we create expiration-date field. this field = Current date/time + seconds:SliderInput. Each slider move = 3600 seconds. So i will add to Current date/time 1 hour. Lets say we save in the database for auction “x” - expiration time= 3600 seconds. This will be visible to everybody as 3600.
The question is, how to count down this value? Can it be done without date somehow?
Basically, most of my workflows will depend on this value, many things will happen when this value=0

Regards Claudiu

I am not quite sure what it is you are after here.

Maybe everything is more simple then i think but as mentioned earlier we have an auction website

Lets take it this way
each auction has creation time and expiration time.
I need to show the same duration value (Expiration date - creation date) of each auction to all the users no matter the timezone.
What would be the best way to do this?

Ah, I see. So timezones are the issue here ?

Hi Nigel . i have figured out everything at the end.
So here it what i did with a little help from @vlad Team.

I believed that, if i use “Current date/time” parameter when creating an auction will cause problems when user will change ccomputer clock. That is wrong because, i was told that actually Bubble is converting time to GMT, so when you do a countdown, it knows what the correct time to the date is.
So in order to create a countdown you need:

  • “Expiration” field in your database
  • ApiWork flow that will be trigger action (in my case, close auction) when “Expiration” value is reached

In order to show seconds dynamic, without page refresh you need:

  • create a group on the page you want to show the counter
    -within the group create a input field or text field
  • initial content - expiration field minus current date-time: format as seconds or what ever is relevant to you
  • go to workflow, Do every 1 second, Set state of the group where your input field is:
    state name: current-time
    state type : date
    You can check functionality here: https://bubble.io/page?type=page&name=auction&id=bidy-public&tab=tabs-1

Thats it :slight_smile:

1 Like

Cool. Are those workflows chargeable ?

nope. it s 100% free. Only using Bubble API

1 Like

What I meant was do those “every second” workflows count towards your plan allowance.