/// <summary>
/// Adjusts dates which fall on a Saturday to the preceding Friday, and
/// those falling on a Sunday to the following Monday. This convention
/// is used by some national holidays, for example Christmas Day in the
/// USA.
/// </summary>
/// <param name="calendar">The <see cref="Calendar"/> to be used.</param>
/// <param name="date">The <see cref="Date"/> to adjust.</param>
/// <returns>A (possibly) adjusted <see cref="Date"/> instance.</returns>
private static Date Weekend(Calendar calendar, Date date)
{
switch (date.Weekday)
{
case Date.SATURDAY: return(date.PlusDays(-1));
case Date.SUNDAY: return(date.PlusDays(+1));
}
return(date);
}