Issue: Unable to Add 1 Hour to Date/Time in Conditional Logic

Problem Summary:
I am trying to set up a condition in my Bubble app where a user has to wait 1 hour before they can retry a quiz if they fail. I want to compare the current time (Current date/time) with the time 1 hour after the user’s last quiz failure (stored in last_failed_time). However, I am having trouble using the :plus operator in the conditional logic to add 1 hour to the last_failed_time.

What I’ve Tried:

  1. I’ve selected Current date/time and Search for Total course Progress's last_failed_time, but when I try to add :plus hours 1, I don’t see this option in the dropdown.
  2. I’ve tried typing :plus manually, but the Bubble editor doesn’t seem to recognize it within the condition builder.
  3. I’ve explored using operators like formatted as text or formatted as number, but they don’t allow me to compare dates with added time.

What I Want to Achieve: I need to check if 1 hour has passed since the user’s last quiz failure, with a condition like:

sql

Copy code

Current date/time > last_failed_time:plus hours 1

Questions:

  • Is there a specific way to add time (like 1 hour) to a date in a condition without using workflows?
  • Is there another approach I should try for comparing the current time and a time that’s 1 hour later than the last_failed_time?

Any advice on how to add 1 hour to a date/time field in a condition would be greatly appreciated!


Additional Details:

  • I’ve added a field in my database (last_failed_time) to track when the user last failed the quiz.
  • I want the user to wait 1 hour before they can retry the quiz, and the condition should only allow retry if 1 hour has passed.
    image

Hi @ii8m3r255. If you’re still encountering this issue, try converting the date to a timestamp and then add 3600 (since 1 hour = 3600 seconds).

:plus item is used for lists in Bubble, + is used for numbers/dates.

I’m pretty sure this is due to Bubble’s left-to-right expression evaluation and would be easily resolved using parentheses. Current date / time > Search:first item’s value evaluates to a yes/no, not a date.

Enable parantheses in Settings → Versions → Experimental features and you’ll be good to go with +hours (1)

It’s because current datetime > xxx returns a true or false, bubble doesn’t add the plus operator in a virtual parentheses. According to bubble you are trying to add date to a boolean. The solution is simple. You just need to write the second part as the first part.

Search for …first item…last time quiz + plus … < current datetime

thank you, you got it