0

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.

Darren Cook
  • 661
  • 4
  • 14
  • 28

1 Answers1

2

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
  • 19,333
  • 6
  • 58
  • 52
  • 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 Jan 13 '10 at 13:16
  • 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 Jan 13 '10 at 14:55