Example #1
0
 bool Norway::Impl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // Holy Thursday
         || (dd == em-4)
         // Good Friday
         || (dd == em-3)
         // Easter Monday
         || (dd == em)
         // Ascension Thursday
         || (dd == em+38)
         // Whit Monday
         || (dd == em+49)
         // New Year's Day
         || (d == 1  && m == January)
         // May Day
         || (d == 1  && m == May)
         // National Independence Day
         || (d == 17  && m == May)
         // Christmas
         || (d == 25 && m == December)
         // Boxing Day
         || (d == 26 && m == December))
         return false;
     return true;
 }
Example #2
0
 bool Ukraine::UseImpl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // New Year's Day (possibly moved to Monday)
         || ((d == 1 || ((d == 2 || d == 3) && w == Monday))
             && m == January)
         // Orthodox Christmas
         || ((d == 7 || ((d == 8 || d == 9) && w == Monday))
             && m == January)
         // Women's Day
         || ((d == 8 || ((d == 9 || d == 10) && w == Monday))
             && m == March)
         // Orthodox Easter Monday
         || (dd == em)
         // Holy Trinity Day
         || (dd == em+49)
         // Workers' Solidarity Days
         || ((d == 1 || d == 2 || (d == 3 && w == Monday)) && m == May)
         // Victory Day
         || ((d == 9 || ((d == 10 || d == 11) && w == Monday)) && m == May)
         // Constitution Day
         || (d == 28 && m == June)
         // Independence Day
         || (d == 24 && m == August)
         // Defender's Day (since 2015)
         || (d == 14 && m == October && y >= 2015))
         return false;
     return true;
 }
Example #3
0
 bool Helsinki::Impl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if ((w == Saturday || w == Sunday)
         // New Year's Day
         || (d == 1 && m == January)
         // Epiphany
         || (d == 6 && m == January)
         // Good Friday
         || (dd == em-3)
         // Easter Monday
         || (dd == em)
         // Ascension Thursday
         || (dd == em+38)
         // Labour Day
         || (d == 1 && m == May)
         // Midsummer Eve (Friday between June 18-24)
         || (w == Friday && (d >= 18 && d <= 24) && m == June)
         // Independence Day
         || (d == 6 && m == December)
         // Christmas Eve
         || (d == 24 && m == December)
         // Christmas
         || (d == 25 && m == December)
         // Boxing Day
         || (d == 26 && m == December))
             return false;
     return true;
 }
Example #4
0
    bool Brazil::SettlementImpl::isBusinessDay(const Date& date) const {
        Weekday w = date.weekday();
        Day d = date.dayOfMonth();
        Month m = date.month();
        Year y = date.year();
        Day dd = date.dayOfYear();
        Day em = easterMonday(y);

        if (isWeekend(w)
            // New Year's Day
            || (d == 1 && m == January)
            // Tiradentes Day
            || (d == 21 && m == April)
            // Labor Day
            || (d == 1 && m == May)
            // Independence Day
            || (d == 7 && m == September)
            // Nossa Sra. Aparecida Day
            || (d == 12 && m == October)
            // All Souls Day
            || (d == 2 && m == November)
            // Republic Day
            || (d == 15 && m == November)
            // Christmas
            || (d == 25 && m == December)
            // Passion of Christ
            || (dd == em-3)
            // Carnival
            || (dd == em-49 || dd == em-48)
            // Corpus Christi
            || (dd == em+59)
            )
            return false;
        return true;
    }
Example #5
0
 //! see http://www.dti.gov.uk/er/bankhol.htm
 bool London::Impl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if ((w == Saturday || w == Sunday)
         // New Year's Day (possibly moved to Monday)
         || ((d == 1 || ((d == 2 || d == 3) && w == Monday)) &&
             m == January)
         // Good Friday
         || (dd == em-3)
         // Easter Monday
         || (dd == em)
         // first Monday of May (Early May Bank Holiday)
         || (d <= 7 && w == Monday && m == May)
         // last Monday of May (Spring Bank Holiday)
         || (d >= 25 && w == Monday && m == May && y != 2002)
         // last Monday of August (Summer Bank Holiday)
         || (d >= 25 && w == Monday && m == August)
         // Christmas (possibly moved to Monday or Tuesday)
         || ((d == 25 || (d == 27 && (w == Monday || w == Tuesday)))
             && m == December)
         // Boxing Day (possibly moved to Monday or Tuesday)
         || ((d == 26 || (d == 28 && (w == Monday || w == Tuesday)))
             && m == December)
         // June 3rd, 2002 only (Golden Jubilee Bank Holiday)
         // June 4rd, 2002 only (special Spring Bank Holiday)
         || ((d == 3 || d == 4) && m == June && y == 2002)
         // December 31st, 1999 only
         || (d == 31 && m == December && y == 1999))
             return false;
     return true;
 }
Example #6
0
 bool Romania::Impl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // New Year's Day
         || (d == 1 && m == January)
         // Day after New Year's Day
         || (d == 2 && m == January)
         // Unification Day
         || (d == 24 && m == January)
         // Orthodox Easter Monday
         || (dd == em)
         // Labour Day
         || (d == 1 && m == May)
         // Pentecost
         || (dd == em+49)
         // St Marys Day
         || (d == 15 && m == August)
         // Feast of St Andrew
         || (d == 30 && m == November)
         // National Day
         || (d == 1 && m == December)
         // Christmas
         || (d == 25 && m == December)
         // 2nd Day of Chritsmas
         || (d == 26 && m == December))
         return false;
     return true;
 }
Example #7
0
 bool Italy::ExchangeImpl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // New Year's Day
         || (d == 1 && m == January)
         // Good Friday
         || (dd == em-3)
         // Easter Monday
         || (dd == em)
         // Labour Day
         || (d == 1 && m == May)
         // Assumption
         || (d == 15 && m == August)
         // Christmas' Eve
         || (d == 24 && m == December)
         // Christmas
         || (d == 25 && m == December)
         // St. Stephen
         || (d == 26 && m == December)
         // New Year's Eve
         || (d == 31 && m == December))
         return false;
     return true;
 }
Example #8
0
 bool Italy::SettlementImpl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // New Year's Day
         || (d == 1 && m == January)
         // Epiphany
         || (d == 6 && m == January)
         // Easter Monday
         || (dd == em)
         // Liberation Day
         || (d == 25 && m == April)
         // Labour Day
         || (d == 1 && m == May)
         // Republic Day
         || (d == 2 && m == June && y >= 2000)
         // Assumption
         || (d == 15 && m == August)
         // All Saints' Day
         || (d == 1 && m == November)
         // Immaculate Conception
         || (d == 8 && m == December)
         // Christmas
         || (d == 25 && m == December)
         // St. Stephen
         || (d == 26 && m == December)
         // December 31st, 1999 only
         || (d == 31 && m == December && y == 1999))
         return false;
     return true;
 }
Example #9
0
static bool isNonWorkingDay(const Date *theDate) {
	Date d;
	
	// Common public holidays
	if (theDate->day == 1  && theDate->month == JAN) return true; // New year's day
	if (theDate->day == 11 && theDate->month == NOV) return true; // Armistice 1918 // Veteran's day
	if (theDate->day == 25 && theDate->month == DEC) return true; // Noël // Christmas

#if NWD_COUNTRY == NWD_FRANCE
	if (theDate->day == 1  && theDate->month == MAY) return true; // Fête du travail
	if (theDate->day == 8  && theDate->month == MAY) return true; // Armistice 1945
	if (theDate->day == 14 && theDate->month == JUL) return true; // Fête nationale
	if (theDate->day == 15 && theDate->month == AUG) return true; // Assomption
	if (theDate->day == 1  && theDate->month == NOV) return true; // Toussaint
	
	easterMonday(theDate->year, &d);
	if (theDate->day == d.day && theDate->month == d.month) return true; // Lundi de Pâques
	ascensionDay(theDate->year, &d);
	if (theDate->day == d.day && theDate->month == d.month) return true; // Jeudi de l'ascension
	whitMonday(theDate->year, &d);
	if (theDate->day == d.day && theDate->month == d.month) return true; // Lundi de Pentecôte

#elif NWD_COUNTRY == NWD_USA
	if (theDate->day == 4 && theDate->month == JUL) return true; // Independence day

	switch (theDate->month) {
	case JAN:
		MLKBirthday(theDate->year, &d); 
		if (theDate->day == d.day && theDate->month == d.month) return true; // Martin Luther King Jr.'s Birthday
		break;
	case FEB:
		presidentDay(theDate->year, &d);
        	if (theDate->day == d.day && theDate->month == d.month) return true; // President's day
		break;
	case MAY:
		memorialDay(theDate->year, &d);
        	if (theDate->day == d.day && theDate->month == d.month) return true; // Memorial Day
		break;
	case SEP:
		laborDay(theDate->year, &d);
        	if (theDate->day == d.day && theDate->month == d.month) return true; // Labor Day
		break;
	case OCT:
		columbusDay(theDate->year, &d);
        	if (theDate->day == d.day && theDate->month == d.month) return true; // Columbus Day
		break;
	case NOV:
		thanksgivingThursday(theDate->year, &d);
        	if (theDate->day == d.day && theDate->month == d.month) return true; // Thanksgiving thursday
		thanksgivingFriday(theDate->year, &d);
        	if (theDate->day == d.day && theDate->month == d.month) return true; // Thanksgiving friday
		break;
	}

#endif
	return false;
}
Example #10
0
 bool Johannesburg::Impl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if ((w == Saturday || w == Sunday)
         // New Year's Day (possibly moved to Monday)
         || ((d == 1 || (d == 2 && w == Monday)) && m == January)
         // Good Friday
         || (dd == em-3)
         // Family Day 
         || (dd == em)
         // Human Rights Day, March 21st (possibly moved to Monday)
         || ((d == 21 || (d == 22 && w == Monday)) 
             && m == March)
         // Freedom Day, April 27th (possibly moved to Monday)
         || ((d == 27 || (d == 28 && w == Monday)) 
             && m == April)
         // Workers Day, May 1st (possibly moved to Monday)
         || ((d == 1 || (d == 2 && w == Monday)) 
             && m == May)
         // Youth Day, June 16th (possibly moved to Monday)
         || ((d == 16 || (d == 17 && w == Monday)) 
             && m == June)
         // National Women's Day, August 9th (possibly moved to Monday)
         || ((d == 9 || (d == 10 && w == Monday)) 
             && m == August)
         // Heritage Day, September 24th (possibly moved to Monday)
         || ((d == 24 || (d == 25 && w == Monday)) 
             && m == September)
         // Day of Reconciliation, December 16th 
         // (possibly moved to Monday)
         || ((d == 16 || (d == 17 && w == Monday)) 
             && m == December)
         // Christmas 
         || (d == 25 && m == December)
         // Day of Goodwill (possibly moved to Monday)
         || ((d == 26 || (d == 27 && w == Monday)) 
             && m == December)
         )
         return false;
     return true;
 }
Example #11
0
    bool Brazil::ExchangeImpl::isBusinessDay(const Date& date) const {
        Weekday w = date.weekday();
        Day d = date.dayOfMonth();
        Month m = date.month();
        Year y = date.year();
        Day dd = date.dayOfYear();
        Day em = easterMonday(y);

        if (isWeekend(w)
            // New Year's Day
            || (d == 1 && m == January)
            // Sao Paulo City Day
            || (d == 25 && m == January)
            // Tiradentes Day
            || (d == 21 && m == April)
            // Labor Day
            || (d == 1 && m == May)
            // Revolution Day
            || (d == 9 && m == July)
            // Independence Day
            || (d == 7 && m == September)
            // Nossa Sra. Aparecida Day
            || (d == 12 && m == October)
            // All Souls Day
            || (d == 2 && m == November)
            // Republic Day
            || (d == 15 && m == November)
            // Black Consciousness Day
            || (d == 20 && m == November && y >= 2007)
            // Christmas
            || (d == 25 && m == December)
            // Passion of Christ
            || (dd == em-3)
            // Carnival
            || (dd == em-49 || dd == em-48)
            // Corpus Christi
            || (dd == em+59)
            // last business day of the year
            || (m == December && (d == 31 || (d >= 29 && w == Friday)))
            )
            return false;
        return true;
    }
Example #12
0
 bool UnitedKingdom::ExchangeImpl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // New Year's Day (possibly moved to Monday)
         || ((d == 1 || ((d == 2 || d == 3) && w == Monday)) &&
             m == January)
         // Good Friday
         || (dd == em-3)
         // Easter Monday
         || (dd == em)
         // first Monday of May (Early May Bank Holiday)
         || (d <= 7 && w == Monday && m == May)
         // last Monday of May (Spring Bank Holiday)
         || (d >= 25 && w == Monday && m == May && y != 2002 && y != 2012)
         // last Monday of August (Summer Bank Holiday)
         || (d >= 25 && w == Monday && m == August)
         // Christmas (possibly moved to Monday or Tuesday)
         || ((d == 25 || (d == 27 && (w == Monday || w == Tuesday)))
             && m == December)
         // Boxing Day (possibly moved to Monday or Tuesday)
         || ((d == 26 || (d == 28 && (w == Monday || w == Tuesday)))
             && m == December)
         // June 3rd, 2002 only (Golden Jubilee Bank Holiday)
         // June 4rd, 2002 only (special Spring Bank Holiday)
         || ((d == 3 || d == 4) && m == June && y == 2002)
         // April 29th, 2011 only (Royal Wedding Bank Holiday)
         || (d == 29 && m == April && y == 2011)
         // June 4th, 2012 only (Diamond Jubilee Bank Holiday)
         // June 5th, 2012 only (Special Spring Bank Holiday)
         || ((d == 4 || d == 5) && m == June && y == 2012)
         // December 31st, 1999 only
         || (d == 31 && m == December && y == 1999))
         return false;
     return true;
 }
Example #13
0
 bool CzechRepublic::PseImpl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // New Year's Day
         || (d == 1 && m == January)
         // Easter Monday
         || (dd == em)
         // Labour Day
         || (d == 1 && m == May)
         // Liberation Day
         || (d == 8 && m == May)
         // SS. Cyril and Methodius
         || (d == 5 && m == July)
         // Jan Hus Day
         || (d == 6 && m == July)
         // Czech Statehood Day
         || (d == 28 && m == September)
         // Independence Day
         || (d == 28 && m == October)
         // Struggle for Freedom and Democracy Day
         || (d == 17 && m == November)
         // Christmas Eve
         || (d == 24 && m == December)
         // Christmas
         || (d == 25 && m == December)
         // St. Stephen
         || (d == 26 && m == December)
         // unidentified closing days for stock exchange
         || (d == 2 && m == January && y == 2004)
         || (d == 31 && m == December && y == 2004))
         return false;
     return true;
 }
Example #14
0
 bool NewZealand::Impl::isBusinessDay(const Date& date) const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // New Year's Day (possibly moved to Monday or Tuesday)
         || ((d == 1 || (d == 3 && (w == Monday || w == Tuesday))) &&
             m == January)
         // Day after New Year's Day (possibly moved to Mon or Tuesday)
         || ((d == 2 || (d == 4 && (w == Monday || w == Tuesday))) &&
             m == January)
         // Anniversary Day, Monday nearest January 22nd
         || ((d >= 19 && d <= 25) && w == Monday && m == January)
         // Waitangi Day. February 6th
         || (d == 6 && m == February)
         // Good Friday
         || (dd == em-3)
         // Easter Monday
         || (dd == em)
         // ANZAC Day. April 25th
         || (d == 25 && m == April)
         // Queen's Birthday, first Monday in June
         || (d <= 7 && w == Monday && m == June)
         // Labour Day, fourth Monday in October
         || ((d >= 22 && d <= 28) && w == Monday && m == October)
         // Christmas, December 25th (possibly Monday or Tuesday)
         || ((d == 25 || (d == 27 && (w == Monday || w == Tuesday)))
             && m == December)
         // Boxing Day, December 26th (possibly Monday or Tuesday)
         || ((d == 26 || (d == 28 && (w == Monday || w == Tuesday)))
             && m == December))
         return false;
     return true;
 }
Example #15
0
 bool UnitedStates::GovernmentBondImpl::isBusinessDay(const Date& date)
                                                                   const {
     Weekday w = date.weekday();
     Day d = date.dayOfMonth(), dd = date.dayOfYear();
     Month m = date.month();
     Year y = date.year();
     Day em = easterMonday(y);
     if (isWeekend(w)
         // New Year's Day (possibly moved to Monday if on Sunday)
         || ((d == 1 || (d == 2 && w == Monday)) && m == January)
         // Martin Luther King's birthday (third Monday in January)
         || ((d >= 15 && d <= 21) && w == Monday && m == January)
         // Washington's birthday (third Monday in February)
         || ((d >= 15 && d <= 21) && w == Monday && m == February)
         // Good Friday
         || (dd == em-3)
         // Memorial Day (last Monday in May)
         || (d >= 25 && w == Monday && m == May)
         // Independence Day (Monday if Sunday or Friday if Saturday)
         || ((d == 4 || (d == 5 && w == Monday) ||
              (d == 3 && w == Friday)) && m == July)
         // Labor Day (first Monday in September)
         || (d <= 7 && w == Monday && m == September)
         // Columbus Day (second Monday in October)
         || ((d >= 8 && d <= 14) && w == Monday && m == October)
         // Veteran's Day (Monday if Sunday or Friday if Saturday)
         || ((d == 11 || (d == 12 && w == Monday) ||
              (d == 10 && w == Friday)) && m == November)
         // Thanksgiving Day (fourth Thursday in November)
         || ((d >= 22 && d <= 28) && w == Thursday && m == November)
         // Christmas (Monday if Sunday or Friday if Saturday)
         || ((d == 25 || (d == 26 && w == Monday) ||
              (d == 24 && w == Friday)) && m == December))
         return false;
     return true;
 }
Example #16
0
    bool Singapore::SgxImpl::isBusinessDay(const Date& date) const {
        Weekday w = date.weekday();
        Day d = date.dayOfMonth(), dd = date.dayOfYear();
        Month m = date.month();
        Year y = date.year();
        Day em = easterMonday(y);

        if (isWeekend(w)
            // New Year's Day
            || ((d == 1 || (d == 2 && w == Monday)) && m == January)
            // Good Friday
            || (dd == em-3)
            // Labor Day
            || (d == 1 && m == May)
            // National Day
            || ((d == 9 || (d == 10 && w == Monday)) && m == August)
            // Christmas Day
            || (d == 25 && m == December)

            // Chinese New Year
            || ((d == 22 || d == 23) && m == January && y == 2004)
            || ((d == 9 || d == 10) && m == February && y == 2005)
            || ((d == 30 || d == 31) && m == January && y == 2006)
            || ((d == 19 || d == 20) && m == February && y == 2007)
            || ((d == 7 || d == 8) && m == February && y == 2008)
            || ((d == 26 || d == 27) && m == January && y == 2009)
            || ((d == 15 || d == 16) && m == January && y == 2010)
            || ((d == 23 || d == 24) && m == January && y == 2012)
            || ((d == 11 || d == 12) && m == February && y == 2013)
            || (d == 31 && m == January && y == 2014)
            || (d == 1 && m == February && y == 2014)

            // Hari Raya Haji
            || ((d == 1 || d == 2) && m == February && y == 2004)
            || (d == 21 && m == January && y == 2005)
            || (d == 10 && m == January && y == 2006)
            || (d == 2 && m == January && y == 2007)
            || (d == 20 && m == December && y == 2007)
            || (d == 8 && m == December && y == 2008)
            || (d == 27 && m == November && y == 2009)
            || (d == 17 && m == November && y == 2010)
            || (d == 26 && m == October && y == 2012)
            || (d == 15 && m == October && y == 2013)
            || (d == 6 && m == October && y == 2014)

            // Vesak Poya Day
            || (d == 2 && m == June && y == 2004)
            || (d == 22 && m == May && y == 2005)
            || (d == 12 && m == May && y == 2006)
            || (d == 31 && m == May && y == 2007)
            || (d == 18 && m == May && y == 2008)
            || (d == 9 && m == May && y == 2009)
            || (d == 28 && m == May && y == 2010)
            || (d == 5 && m == May && y == 2012)
            || (d == 24 && m == May && y == 2013)
            || (d == 13 && m == May && y == 2014)

            // Deepavali
            || (d == 11 && m == November && y == 2004)
            || (d == 8 && m == November && y == 2007)
            || (d == 28 && m == October && y == 2008)
            || (d == 16 && m == November && y == 2009)
            || (d == 5 && m == November && y == 2010)
            || (d == 13 && m == November && y == 2012)
            || (d == 2 && m == November && y == 2013)
            || (d == 23 && m == October && y == 2014)

            // Diwali
            || (d == 1 && m == November && y == 2005)

            // Hari Raya Puasa
            || ((d == 14 || d == 15) && m == November && y == 2004)
            || (d == 3 && m == November && y == 2005)
            || (d == 24 && m == October && y == 2006)
            || (d == 13 && m == October && y == 2007)
            || (d == 1 && m == October && y == 2008)
            || (d == 21 && m == September && y == 2009)
            || (d == 10 && m == September && y == 2010)
            || (d == 20 && m == August && y == 2012)
            || (d == 8 && m == August && y == 2013)
            || (d == 28 && m == July && y == 2014)
            )
            return false;
        return true;
    }
Example #17
0
static void whitMonday(const int Y, Date *theDate) {
	easterMonday(Y, theDate);
	dateAddDays(theDate, 49);
}
Example #18
0
static void ascensionDay(const int Y, Date *theDate) {
	easterMonday(Y, theDate);
	dateAddDays(theDate, 38);
}
Example #19
0
    bool UnitedStates::NyseImpl::isBusinessDay(const Date& date) const {
        Weekday w = date.weekday();
        Day d = date.dayOfMonth(), dd = date.dayOfYear();
        Month m = date.month();
        Year y = date.year();
        Day em = easterMonday(y);
        if (isWeekend(w)
            // New Year's Day (possibly moved to Monday if on Sunday)
            || ((d == 1 || (d == 2 && w == Monday)) && m == January)
            // Washington's birthday (third Monday in February)
            || ((d >= 15 && d <= 21) && w == Monday && m == February)
            // Good Friday
            || (dd == em-3)
            // Memorial Day (last Monday in May)
            || (d >= 25 && w == Monday && m == May)
            // Independence Day (Monday if Sunday or Friday if Saturday)
            || ((d == 4 || (d == 5 && w == Monday) ||
                 (d == 3 && w == Friday)) && m == July)
            // Labor Day (first Monday in September)
            || (d <= 7 && w == Monday && m == September)
            // Thanksgiving Day (fourth Thursday in November)
            || ((d >= 22 && d <= 28) && w == Thursday && m == November)
            // Christmas (Monday if Sunday or Friday if Saturday)
            || ((d == 25 || (d == 26 && w == Monday) ||
                 (d == 24 && w == Friday)) && m == December)
            ) return false;

        if (y >= 1998) {
            if (// Martin Luther King's birthday (third Monday in January)
                ((d >= 15 && d <= 21) && w == Monday && m == January)
                // President Reagan's funeral
                || (y == 2004 && m == June && d == 11)
                // September 11, 2001
                || (y == 2001 && m == September && (11 <= d && d <= 14))
                // President Ford's funeral
                || (y == 2007 && m == January && d == 2)
                ) return false;
        } else if (y <= 1980) {
            if (// Presidential election days
                ((y % 4 == 0) && m == November && d <= 7 && w == Tuesday)
                // 1977 Blackout
                || (y == 1977 && m == July && d == 14)
                // Funeral of former President Lyndon B. Johnson.
                || (y == 1973 && m == January && d == 25)
                // Funeral of former President Harry S. Truman
                || (y == 1972 && m == December && d == 28)
                // National Day of Participation for the lunar exploration.
                || (y == 1969 && m == July && d == 21)
                // Funeral of former President Eisenhower.
                || (y == 1969 && m == March && d == 31)
                // Closed all day - heavy snow.
                || (y == 1969 && m == February && d == 10)
                // Day after Independence Day.
                || (y == 1968 && m == July && d == 5)
                // June 12-Dec. 31, 1968
                // Four day week (closed on Wednesdays) - Paperwork Crisis
                || (y == 1968 && dd >= 163 && w == Wednesday)
                ) return false;
        } else {
            if (// Nixon's funeral
                (y == 1994 && m == April && d == 27)
                ) return false;
        }


        return true;
    }
Example #20
0
    bool Indonesia::BejImpl::isBusinessDay(const Date& date) const {
        Weekday w = date.weekday();
        Day d = date.dayOfMonth();
        Month m = date.month();
        Year y = date.year();
        Day dd = date.dayOfYear();
        Day em = easterMonday(y);

        if (isWeekend(w)
            // New Year's Day
            || (d == 1 && m == January)
            // Good Friday
            || (dd == em-3)
            // Ascension Thursday
            || (dd == em+38)
            // Independence Day
            || (d == 17 && m == August)
            // Christmas
            || (d == 25 && m == December)
            )
            return false;

        if (y == 2005) {
            if (// Idul Adha
                (d == 21 && m == January)
                // Imlek
                || (d == 9 && m == February)
                // Moslem's New Year Day
                || (d == 10 && m == February)
                // Nyepi
                || (d == 11 && m == March)
                // Birthday of Prophet Muhammad SAW
                || (d == 22 && m == April)
                // Waisak
                || (d == 24 && m == May)
                // Ascension of Prophet Muhammad SAW
                || (d == 2 && m == September)
                // Idul Fitri
                || ((d == 3 || d == 4) && m == November)
                // National leaves
                || ((d == 2 || d == 7 || d == 8) && m == November)
                || (d == 26 && m == December)
                )
                return false;
        }

        if (y == 2006) {
            if (// Idul Adha
                (d == 10 && m == January)
                // Moslem's New Year Day
                || (d == 31 && m == January)
                // Nyepi
                || (d == 30 && m == March)
                // Birthday of Prophet Muhammad SAW
                || (d == 10 && m == April)
                // Ascension of Prophet Muhammad SAW
                || (d == 21 && m == August)
                // Idul Fitri
                || ((d == 24 || d == 25) && m == October)
                // National leaves
                || ((d == 23 || d == 26 || d == 27) && m == October)
                )
                return false;
        }

        if (y == 2007) {
            if (// Nyepi
                (d == 19 && m == March)
                // Waisak
                || (d == 1 && m == June)
                // Ied Adha
                || (d == 20 && m == December)
                // National leaves
                || (d == 18 && m == May)
                || ((d == 12 || d == 15 || d == 16) && m == October)
                || ((d == 21 || d == 24) && m == October)
                )
                return false;
        }

        if (y == 2008) {
            if (// Islamic New Year
                ((d == 10 || d == 11) && m == January)
                // Chinese New Year
                || ((d == 7 || d == 8) && m == February)
                // Saka's New Year
                || (d == 7 && m == March)
                // Birthday of the prophet Muhammad SAW
                || (d == 20 && m == March)
                // Vesak Day
                || (d == 20 && m == May)
                // Isra' Mi'raj of the prophet Muhammad SAW
                || (d == 30 && m == July)
                // National leave
                || (d == 18 && m == August)
                // Ied Fitr
                || (d == 30 && m == September)
                || ((d == 1 || d == 2 || d == 3) && m == October)
                // Ied Adha
                || (d == 8 && m == December)
                // Islamic New Year
                || (d == 29 && m == December)
                // New Year's Eve
                || (d == 31 && m == December)
                )
                return false;
        }

        if (y == 2009) {
            if (// Public holiday
                (d == 2 && m == January)
                // Chinese New Year
                || (d == 26 && m == January)
                // Birthday of the prophet Muhammad SAW
                || (d == 9 && m == March)
                // Saka's New Year
                || (d == 26 && m == March)
                // National leave
                || (d == 9 && m == April)
                // Isra' Mi'raj of the prophet Muhammad SAW
                || (d == 20 && m == July)
                // Ied Fitr
                || (d >= 18 && d <= 23 && m == September)
                // Ied Adha
                || (d == 27 && m == November)
                // Islamic New Year
                || (d == 18 && m == December)
                // Public Holiday
                || (d == 24 && m == December)
                // Trading holiday
                || (d == 31 && m == December)
                )
                return false;
        }

        if (y == 2010) {
            if (// Birthday of the prophet Muhammad SAW
                   (d == 26 && m == February)
                // Saka's New Year
                || (d == 16 && m == March)
                // Birth of Buddha
                || (d == 28 && m == May)
                // Ied Fitr
                || (d >= 8 && d <= 14 && m == September)
                // Ied Adha
                || (d == 17 && m == November)
                // Islamic New Year
                || (d == 7 && m == December)
                // Public Holiday
                || (d == 24 && m == December)
                // Trading holiday
                || (d == 31 && m == December)
                )
                return false;
        }

        if (y == 2011) {
            if (// Chinese New Year
                   (d == 3 && m == February)
                // Birthday of the prophet Muhammad SAW
                || (d == 15 && m == February)
                // Birth of Buddha
                || (d == 17 && m == May)
                // Isra' Mi'raj of the prophet Muhammad SAW
                || (d == 29 && m == June)
                // Ied Fitr
                || (d >= 29 && m == August)
                || (d <= 2 && m == September)
                // Public Holiday
                || (d == 26 && m == December)
                )
                return false;
        }

        if (y == 2012) {
            if (// Chinese New Year
                (d == 23 && m == January)
                // Saka New Year
                || (d == 23 && m == March)
                // Ied ul-Fitr
                || (d >= 20 && d <= 22 && m == August)
                // Eid ul-Adha
                || (d == 26 && m == October)
                // Islamic New Year
                || (d >= 15 && d <= 16 && m == November)
                // Public Holiday
                || (d == 24 && m == December)
                // Trading Holiday
                || (d == 31 && m == December)
                )
                return false;
        }

        if (y == 2013) {
            if (// Birthday of the prophet Muhammad SAW
                (d == 24 && m == January)
                // Saka New Year
                || (d == 12 && m == March)
                // Isra' Mi'raj of the prophet Muhammad SAW
                || (d == 6 && m == June)
                // Ied ul-Fitr
                || (d >= 5 && d <= 9 && m == August)
                // Eid ul-Adha
                || (d >= 14 && d <= 15 && m == October)
                // Islamic New Year
                || (d == 5 && m == November)
                // Public Holiday
                || (d == 26 && m == December)
                // Trading Holiday
                || (d == 31 && m == December)
                )
                return false;
        }

        if (y == 2014) {
            if (// Birthday of the prophet Muhammad SAW
                (d == 14 && m == January)
                // Chinese New Year
                || (d == 31 && m == January)
                // Saka New Year
                || (d == 31 && m == March)
                // Labour Day
                || (d == 1 && m == May)
                // Birth of Buddha
                || (d == 15 && m == May)
                // Isra' Mi'raj of the prophet Muhammad SAW
                || (d == 27 && m == May)
                // Ascension Day of Jesus Christ
                || (d == 29 && m == May)
                // Ied ul-Fitr
                || ((d >= 28 && m == July) || (d == 1 && m == August))
                // Public Holiday
                || (d == 26 && m == December)
                // Trading Holiday
                || (d == 31 && m == December)
                )
                return false;
        }

        return true;
    }