Click here to Skip to main content
15,884,821 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am having a field in my form which is "Time". It is jQuery time picker. I can see the time every half hourly,i have given specific time i.e; from morning 7-am to evening 7-pm.I have taken the time like this as it will be used for giving appointments and in a particular time-slot only 3 customers can get appointment.And,i also want to disable the time,which has gone in the present day and the previous days as well.I don't want to do it with Database.

XML
<script>
    $(function () {

        jQuery('#onselectExample').timepicker({
            'minTime': '7:00am',
            'maxTime': '7:00pm',
            //format: 'H:i'
        });
    });
</script>

<div class="row">
<div class="large-4 columns left" style="text-align:right;">
@Html.Label("Time")   
</div>
<div class="large-7 columns left">
<input id="onselectExample" type="text" class="time"  name="onselectExample" required/>
</div>
</div>
Posted
Updated 21-Apr-15 21:10pm
v3
Comments
vbmike 21-Apr-15 11:48am    
According to the 'documentation' page for timepicker, there is an option called disableTimeRanges that you can probably use. You would have to have some logic in your code that would then populate the timepicker option with a range of time you wanted to disable based on your statments above. Look into the documentation for the script, there are a lot of options. If one does not fit you should email the author to see if they are working on a solution. FYI, this is for the timepicker by J Thornton on github. I see there are other timepickers available to confuse the issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900