Problems with hourly visibilities

Hi everyone, maybe someone can help me with this.

We created a booking app. You generate the booking and pay the deposit. There’s a cancel booking button that lasts for 1 hour after the deposit is paid. We added a date/time option (currenthorario+1). It’s working fine. The problem is that we also have a 50% refund from the end of the refund period until the next day. ..

Ex: Payment Date: Today 7:30 PM
100% Refund: Today until 8:30 PM
50% Refund: Valid from 8:30.01seg AM until tomorrow 8:30 PM

The problem we encountered is that from the time the 100% refund period ends and the 50% refund button should appear, a minute passes between 8:30 AM and 8:31 AM, and there is no button, and I need the button to be 8:30 AM.

I thought about using true/false when I entered the reservation to activate buttons, but the problem is the delay it takes to deactivate one button and activate the other.

After a second has passed, the deadline should activate the other one.

If I understood correctly, you need to ave the payment time as a record, and then use that saved time to control the button visibility and logic.

Hi @Santiago,

A workaround could be to all relevant times in a separate properties: paymentDateTime, refund100Finish, refund50Start, refund50Finish, noRefundStart. And the formula could be smth like (let’s assume we are paying at Current Time):
paymentDateTime = Current Time
refund100Finish = Current Time + (1/24) // adding one hour
refund50Start = Current Time + (1/24) + 0,00000116 // adding one hour and 1 second, need to play with the decimals to get 1 exactly second as I can’t remember nb of digits Adalo accepts for 1 second. Formula is 1/24/60/60.
refund50Finish = Current Time + (1/24) +1 // adding 1 day and 1 hour
noRefundStart = Current Time + (1/24) +1 + 0,00000116 // adding 1 day, 1 hour and 1 second

Then you can use these properties in visibility conditions.

Just in case, I hope you understand that if a user opens the app within 1hr but waits on this page, the button visibility will not autorefresh unless page is refreshed in some way.

Best,
Victor.

Hi Victor, great… that’s what I did. In the database, I entered the date/time where I stored the date until each action was possible… The problem I was having was that if I entered 10:40, for example, the total refund ended, and at 10:40, another action began.

What I did was the following to avoid the problem of the visibility button not updating on the front end if I don’t refresh the screen…

When I press cancel, it updates the logged-in user (Codetemp) and takes them to a modal… for example, the money refund date/time is after current time, enter 1 in Logged-in user > Codetemp, and I did the same with all the actions… so the one with the visibilities and conditions is the button on the modal page… it works great! I’m not having any problems!

Yes, that’s what I did. The problem was that it didn’t update in seconds but in minutes, so there was a loss of action between one minute and another.

@Santiago so does it work or it does not?
If you set the timestamps programmatically, the visibility should work even with seconds.

I’m going to try that feature… otherwise, I’ll leave the one I invented that already worked (just in case).

I’ll let you know how it went with adding a second to the hour limit!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.