Set start date to be n "working days" ahead.

Modifies the standard Date Prompt to open an interactive calendar in a small overlay.
Post Reply
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Set start date to be n "working days" ahead.

Post by norman »

If you're using Datepicker with weekends disabled, then it's possible to tweak it to make the start date a set number of working days ahead.

To do this (following example is for 4 working days ahead), go to Design / Library / Layouts / Datepicker / Datepicker Setup and look for the line (about line 73):

Code: Select all

      minDate: $(this).attr('sdate'),
Replace it with:

Code: Select all

      minDate: $(this).attr('sdate') - 0 + [0,0,2,2,2,2,1][new Date().getDay()],
The array [0,0,2,2,2,2,1] can be tweaked as desired. It is a range of offsets to be applied to each current day of the week staring with Sunday.
E.g. for 4 working days ahead:

Orders placed on a Sunday or Monday can be delivered within the same week so no offset is required.

Orders placed on a Tuesday through Friday need a 2 day offset because of the full weekend.

Orders placed on a Saturday need a 1 day offset because of the Sunday.

Note that this doesn't take account of national or other holidays. Only weekdays and weekends.
Post Reply