Thread: jQuery JQuery Datepicker
View Single Post
Old 01-28-2013, 11:19 AM   PM User | #1
McG
New to the CF scene

 
Join Date: Jan 2013
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
McG is an unknown quantity at this point
JQuery Datepicker

Hi all,
I'm a CF and JS newbie, so any help would be grateful.
I'm looking for some help on excluding dates from the jQuery datepicker.
The rules for excluding dates are a little complicated, at least to me.

The datepicker is used for choosing an earliest collection date, but the collection date is depended on when you placed the order within business hours.

So...
It needs 48 hours minimum notice in general - easy to do with setting the minDate.
But it gets complicated with orders placed before & after 12pm, and orders placed at weekend.
The break down for earliest collection...

Monday before 12pm = Wednesday / after 12pm = Thursday
Tuesday before 12pm = Thursday / after 12pm = Friday
Wednesday before 12pm = Friday / after 12pm = Saturday
Thursday before 12pm = Saturday & Sunday / after 12pm = Monday
Friday before 12pm = Monday / after 12pm = Tuesday
Saturday & Sunday = Wednesday


Im new to JS, but I have the following code

Any help would be grateful.
Martin

Code:
var dt = new Date();

function time() {
      return dt.getHours() >= 12 ? '+3d' : '+2d';
}

$("input[value*='EnterDate']").val('').datepicker({

minDate:time(),

});
McG is offline   Reply With Quote