[Need Help] How to constrain user input on a time picker

Hi, I am creating a time blocking app, so when a user sets a block of time, it should not be in the past.

  1. is there a way to use the time picker to do this? At the moment, I cannot get it to just show the time and I can’t work out how to restrict the time to the future.

  2. is there a plugin that will do this? I have tried Air date and time dropper

  3. how do I go about doing this? Is there a better way?


What exactly are you trying to do?

1 Like

I want to prevent to user from entering a time or date that is before the current time.

So, for instance, the user wants to create a 15 minute session, and I want the start time of the session to be restricted to after the current time.

Well I’m not sure exactly what you’re doing (or how you’re doing it).

But, assuming you’re using an option set for your timeslots, you can just get the current date/time and extract the hours and minutes then compare those to number attributes on your option set.

That’s probably the approach I would take.

If you’re talking about a Date, that’s a different question. In that case all you need to do is compare the current date time to the dates in question.

If, specifically, you’re talking about using a date/time picker, then just put the minimum date as the current date/time.

1 Like

So it sounds like I cannot prevent the user from selecting a date or time earlier than the current moment, just I can prevent them from saving that?

You can do exactly, as I said, that by setting the minimum date to the current date/time.

Ah, right, I see, the date thing worked, thanks!

I am not using an option set for my time slots - I want the user to be able to choose the session duration and also the time the session should start.

The problem I am seeing right now is that:

  1. I can’t seem to get it to only show the time, and
  2. I can’t set a minimum time to before now
  3. from my results so far, I am unsure how to set it to show the time

so it is showing up a bit of a random time, not sure what it is though…


Also, the time picker is showing the calendar, not a clock…


Time is just a number, so I’d use an option set for you timeslots, then add the number of hours and minutes to the date in your workflow.

As in, a list of durations? Also I’m not sure what you mean by adding the number of hours and minutes to the workflow, sorry…

I have tried to do this by not splitting the date/time picker, but it doesn’t seem to like that, or were you meaning something else?

You can see here that it doesn’t like me trying to put in a minimum hour…


Ah, also, when I remove the minimum hour constraint, I can see that the time picker intervals are every half hour, I definitely need to let my users select a specific time…

What do you mean by ‘a specific time’?

the minimum hour must be a number.

You’re putting a text.

You can set the time interval to anything you like in a date/time picker

The user will want to set the start time to whatever they want it, rather than be limited to the half hour that the time picker seems to let them.

I.e. Start session at 5:43pm but the picker only allows 5.30 or 6pm

Ah, seen, thanks!

1 Like

then set the interval to 1 minute

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.