Choose only time in future

Hello to everyone.

I would like to have a Date/Time Picker where user can select Date, Hour and Minute only from this very moment.
For example now is: 03/16/2017 17:05 I would like so that client could choose closest 03/16/2017 17:06 and check before sending this date if it’s not already occurred. (In scenario when user fill on form for some long).

It would be perfect to have some check box like - Only future date is valid (include minutes).

1 Like

Hi @petrucho

Here’s what you need to do:

That only does date, not time as well.

What you need to do is add a conditional so that if they date selected is today’s date then make the minimum hour = current date times hour > extract hour + something or other.

(because you want to be able to select any hour if it is tommorrow).

If you are doing this every half an hour you can just add 0.5 hours to round up to the next 30 mins. So you might have to do a little fiddling to work out what you need to add to the hour to get it + 1 minute.

1 Like

Thank you @NigelG
With your helpfull comment I’ve got on a right road, but yet still I’m missing something.

To achieve minimum minute we need: current hour + (current minut/60): round 2

But unfortunatelly bubble can’t do math operation inside brackets.
It would be much easier if we could operate with minimum minutes.

I was able to achieve my needs.
Idea is to use hidden input field in order to calculate minutes passed since hour.

Calculating minutes passed since hour:

Applying minimum hour if picked date is today:

Kind’a “hacky” but it works!

2 Likes

I was just looking at exactly this :slight_smile:

Hacky but I think it works !

It works indeed. :smiley:

I always thought ‘today’s date/time’ took care of date and time - thanks for the insight @NigelG and @petrucho !

Details and example here.

https://buildingonbubble.com/block/datetime-picker---future-1489753569204x907546396372500500

Many many years later I had the same requirement! And this was very helpful @petrucho @NigelG. With one small improvement that I think is quite funny to me.

Instead of extracting the hour first I extracted the minute / 60 and then added the :extract hour. Worked perfectly!

(I guess it could also be that bubble changed things since then)

image