tags:

views:

129

answers:

1

Hello, My page uses a JQuery UI Datepicker and loads with the current day selected and weekends and selected dates restricted.

I would like the current selected day to become unavailable at 2pm and the day move forward.

Can anyone help.

+1  A: 

I would just use a variable for the the minDate

var dt = new Date();
if (dt.getHours() > 14) {
    dt = dt.setDate(dt + 1); // go one day in the future
}
$(selector).datepicker({minDate: dt});

You'd just need to use the real javascript Date class methods - which I haven't used in a little while.

Jarrett Meyer
Thanks Jarrett, works fine. One thing though, am I correct in assuming that this will affect the time locally and not the server time (ie, users not in the server time zone will be changed at differing times?)
Darren Cook
Yes, that will be time on the client. If you need server time, you'd need to put the server date in the constructor of the javascript method. Check out http://stackoverflow.com/questions/249721/how-to-convert-datetime-from-json-to-c for converting datetime objects.
Jarrett Meyer