AirDate/TimePicker : Current Date and Rounding to Quarter Hours?

Hi All,

I figure that there must be an easy solution to this but I cannot figure it out.

I want to set initial date to a stored value in the database so that the form can be updated.

BUT the first time sees the airdate/timepicker and before they click on it, they should see no value.

AND - the first view of the calendar WHEN IT POPS OPEN is the current date BUT the minutes rounded to the closest quarter hour.

Eg. if it is 8:39 I want to AirDate/TimePicker to show 8:45…that way if they don’t change the time, it will not be storing a date 8:39…

I have set up the element to only accept 15 min segments so if they actually move the minute slider, it takes them to the next quarter hour, but the first minute value that the user is offered is the 39 minute value or 12 like the image below.

Can Anyone help me with this?

1 Like

Hello @kevin.hunt ,

Hope you’re doing well.

Indeed, performing mathematical operations with basic Bubble functionalities might be a little bit tricky, but it is totally possible to achieve your desired output where the minutes will be rounded to the nearest quarter hour.

For example, you can first extract the minutes from the date as a number:

Then apply the formula that will give you the rounded number to the closest quarter hour:

Finally, in the Air Picker element, simply change the minutes to the result you got:

You can see how this all works yourself on this test page: Seanhootsdemopro | Bubble Editor

Please check it on your end and let us know if everything is clear or if you have any other questions. :pray:

Thanks, and we look forward to your reply.

Best regards,
Support Team
Browse all Zeroqode Plugins for Bubble
Banner_Last3