[SOLVED] How to set minimum date & time

Hey Guys,

I need hep with this problem i am facing. I need to set a minimum Date & time on the Date/Time Picker. Right now the plug in only accepts date or time separately. What i am trying to do is set a minimum date of today +8 hours, so for example if the date / time is 27/09/2016 00:00 then the available dates and times must be greater than 27/09/2016 08:00

I was battling that before. I had two inputs of date picker. I wanted the end date picker to suggest a time +4 hrs on the start date picker.

I put initial content of end date picker to = “start date picker +(days) 0.167”.

I found it tricky to get it the way I wanted when you start adding options and behaviour.

The problem I am facing is similar. The problem with the date picker is that it treats days and hours seperatly.

So if the minimum date is today and the minimum hour is 7 pm the subsequent days are also limited to 7 pm. What I want is to limit the today’s date to 7 pm only. Future dates and time not to be effected.

@NigelG did you face a similar situation?

Yeah, haven’t managed to solve that yet. I skipped it and “opened” the date picker instead. Not the optimal way in my mind, but better than half working solution.

I’m very interested to hear about @NigelG situation.

4 Likes

Thanks @nigel that is ingenious. Never thought of trying that!

@emmanuel, quick question please. Whats the possibility of exposing the minimum and maximum minutes for this element?

@AliFarahat

Im struggling with the same issue, did this solution work for you?

Hi,

For what I understand, you can just use decimal numbers to get the minutes (e.g. 0.5 for 00:30). If you extract that from a date format, juste make sure that you first extract minutes divided by 60 and then extract hours rather than the other way round (otherwise it will divide both hours and minutes per 60 and probably not give the decimal number you expect).

Hope that is clear

1 Like

I was facing the same issue and managed to solve it by using a condition on the input field.

I set the minimum date for the “end date” input to be the same as the date selected in the “start date” input.

Screenshot_1

And to limit the hours, I created the following condition.

When the dates are the same in both fields, it limits the hours. If the end date is later, it allows selecting other hours.

I hope this helps you.