Hi @adamhholmes and @jonah.deleseleuc ,
Really appreciate your support. Yes, the countdown still dissapears.
I don’t know if the timer just dissapears or stops running, but when I go to the home page and then back to the page where the countdown should be, the timer is not there anymore, even though after booking immediately, it was there. I’m sure it has something to do with changing hte page and loosing the data for it.
Alright guys, I m getting closer. What am I doing wrong? It’s driving me crazy.
I think part of the problem was the countdown wasn’t loading dynamicallyat page load. I set another trigger for that. However, now the countdown doesn’ t show up most likely because there’s nothing in it (more below).
Please note the countdown documentation says we have to ADD “something” in end date. THat’s my understanding. If I add a number 5 let’s stay after :hours instead of booking_booked_hours, the formula works, and the countdown shows and starts, however it’s not dynamic. THat doesn’t help, I do need the dynamic formula.
The debugger says the end date is empty?! Is that because the formula is wrong and it can evaluate it?
I think this is being overcomplicated… @adig just so I get this straight:
You’re trying to get booking_hours_used which is being calculated by a booking's end date - booking's start date?
If so, you can just do exactly that booking's end date - booking's start date:formatted in hours
When you say:
What do you mean? What are you counting down to? I don’t really understand how a countdown plays a role here?
Edit: It looks like you’re counting down until the booking start date? If so, just reference the booking's start date then for Current date/time, if you want that to count in-real time, you need to create a custom state that’s something like “currentDateTime” that’s of type date. Then create a “Do every 1 second” action and set that state to the current date/time. Then in your countdown, for your Start Date, reference the custom state.
No, booking hours used willl be used whenever someone stops the booking(countdown). Let’s leave that aside for now.
To start with, I just want a countdown that shows the number of hours and minutes left from that booking which is based on the variable called number_of_hours_booked (number in the database, between 1-8hrs) and the booking’s date start. Or Vice versa. I’m also confused by how the countdown works.
Thanks for the suggestion with the state, but surely it can be done easier.
Number of hours booked is how many hours the user paid for. it’s like a credit for a booking.
I tried current date - booking start and it doesn’t work. see above in the last picture.
I do not have a booking end date. I have number of hours booked. Number of hours is the credit the user has.
The countdown is supposed to show how many hours and minutes are left from his booking from the total credit (in hours). It’s a simple concept.
Create a custom state that stores the current date/time as i described above
Then compute the expression: Custom state current date/time - (booking start +hours: number of hours) :formatted in hours
Then do the same for minutes.
The reason why your countdown above wasn’t counting down is because when you reference “Current date/time,” it’s only the current date/time when the page loads, it doesn’t continue to update – that’s why you do it with a custom state that updates the time every second.
Thanks bud!! @johnny So where do I put this compuation? in the end date of the counter or in the custom state value?. RIght now, im puttin this calculation in the value of that custom state, but I don’t have the options +hours
You should create a custom state called currentDateTime or whatever you want, then create a Do every 1 second action in workflow that has one step which is setting that state to the Current date/time.
Then you can use the expression:
Custom state current date/time - (booking start +hours: number of hours) :formatted in hours in a text field. No need for a plugin…
Thanks a lot Johnny! almost there. The number doesn’t look right but it seems it refreshes.
here is how it looks now and the expression i Have in the text field
all of them except the one you mentioned “currentDateTime” (which is set as current date time in the state) are in the database. booking_start_timne is date type and booked_hours is number in the DB
They’re not. they’re literally either dates or numbers. They are coming from the DB. Values and format are correct there. I checked. Booking’s (all) is a group with type of content “booking”