USHolidays.WSC

A script component to check for US workdays and holidays.
2.3, 2003-01-29

Methods and Properties

Sat2Fri

When this boolean property is true, holidays that fall on a Saturday are observed Friday. False by default.

Sun2Mon

When this boolean property is true, holidays that fall on a Sunday are observed Monday. True by default.

ASAP(opening,closing)

Returns the soonest workday date and time (now, tomorrow morning, after the three-day weekend).

IsOpen(opening,closing)

Returns true if the current moment falls between the given opening and closing times on a workday.

IsHoliday(dt)

True if the given date is a holiday, false otherwise.

IsWorkday(dt)

True if the given date is a workday, false otherwise.

NextWorkday(dt)

Returns the first workday that follows the given date.

PrevWorkday(dt)

Returns the first workday that precedes the given date.

NextNonWorkday(dt)

Returns the first weekend or holiday that follows the given date.

PrevNonWorkday(dt)

Returns the first weekend or holiday that precedes the given date.

NextHoliday(dt)

Returns the first holiday that follows the given date.

PrevHoliday(dt)

Returns the first holiday that precedes the given date.

Holiday(dt)

If the given date is a holiday, this method will return its name.

Holiday List

HolidayDate
New Year's DayJanuary 1 (± 1 day, if observed)
Martin Luther King, Jr. DayThird Monday in January
President's DayThird Monday in February
Memorial DayLast Monday in May
Independence DayJuly 4 (± 1 day, if observed)
Labor DayFirst Monday in September
Columbus DaySecond Monday in October
Veteran's DayNovember 11 (±1 day, if observed)
Thanksgiving DayFourth Thursday in November
Christmas DayDecember 25 (±1 day, if observed)

Examples

Example 1.1. VBScript ASP

<%
Set cal= Server.CreateObject("USHolidays.WSC")
Response.Write "Soonest your order can be processed: " & cal.ASAP(#8:00am#,#6:00pm#)
%>

Example 1.2. JScript WSH

var cal= WScript.CreateObject('USHolidays.WSC');
var datearg= (new Date(WScript.Arguments.Named('date'))).getVarDate();
var day= cal.Holiday(datearg);
if(day) WScript.Echo('Happy '+day+'!');
else if(!cal.Workday(datearg)) WScript.Echo('weekend');

Example 1.3. PerlScript HTA

use Win32::OLE;
use Win32::OLE::NLS ':DATE';
my $cal= Win32::OLE->new('USHolidays.WSC');
my $h= $cal->NextHoliday('2002-03-16');
$window->document->write('<b>'.$h->Date(DATE_LONGDATE).'</b>: '.$cal->Holiday($h));

Setup

  1. Download USHolidays.WSC to the web server (somewhere permanent, like a system directory).

  2. Right-click the file and choose Register.