HandCoded.Finance.DateRoll.Weekend C# (CSharp) Метод

Weekend() приватный статический Метод

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.
private static Weekend ( Calendar calendar, Date date ) : Date
calendar Calendar The to be used.
date Date The to adjust.
Результат Date
        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);
        }