How to use the workalendar.core.WesternCalendar function in workalendar

To help you get started, we’ve selected a few workalendar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github peopledoc / workalendar / workalendar / africa / angola.py View on Github external
from ..core import WesternCalendar
from ..registry_tools import iso_register


@iso_register('AO')
class Angola(WesternCalendar):
    "Angola"
    # Civil holiday
    include_labour_day = True
    labour_day_label = "Dia Internacional do Trabalhador"
    # Christian holidays
    include_fat_tuesday = True
    fat_tuesday_label = "Dia de Carnaval"
    include_good_friday = True
    include_easter_sunday = True
    include_christmas = True
    include_all_souls = True

    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (2, 4, "Dia do Inicio da Luta Armada"),
        (3, 8, "Dia Internacional da Mulher"),
        (4, 4, "Dia da Paz"),
github peopledoc / workalendar / workalendar / oceania / new_zealand.py View on Github external
from datetime import date, timedelta

from ..core import WesternCalendar, MON, SAT, SUN
from ..registry_tools import iso_register


@iso_register("NZ")
class NewZealand(WesternCalendar):
    "New Zealand"
    include_good_friday = True
    include_easter_monday = True
    include_boxing_day = True

    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (1, 2, "Day after New Year's Day"),
        (2, 6, "Waitangi Day"),
        (4, 25, "ANZAC Day")
    )

    def get_queens_birthday(self, year):
        return (
            NewZealand.get_nth_weekday_in_month(year, 6, MON, 1),
            "Queen's Birthday"
        )
github peopledoc / workalendar / workalendar / europe / france.py View on Github external
@iso_register('FR')
class France(WesternCalendar):
    'France'

    # Christian holidays
    include_easter_monday = True
    include_ascension = True
    include_whit_monday = True
    include_all_saints = True
    include_assumption = True

    # Civil holidays
    include_labour_day = True
    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (5, 8, "Victory in Europe Day"),
        (7, 14, "Bastille Day"),
        (11, 11, "Armistice Day"),
    )


class FranceAlsaceMoselle(France):
    "France Alsace/Moselle"
    include_good_friday = True
    include_boxing_day = True
github peopledoc / workalendar / workalendar / africa / sao_tome.py View on Github external
from ..core import WesternCalendar
from ..registry_tools import iso_register


@iso_register('ST')
class SaoTomeAndPrincipe(WesternCalendar):
    "São Tomé and Príncipe"
    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (2, 3, "Martyr's Day"),
        (7, 12, "Independence Day"),
        (9, 6, "Armed Forces Day"),
        (9, 30, "Agricultural Reform Day"),
        (12, 21, "São Tomé Day"),
    )
    # Civil holidays
    include_labour_day = True
    # Christian holidays
    include_all_saints = True
github peopledoc / workalendar / workalendar / europe / portugal.py View on Github external
from datetime import date
from ..core import WesternCalendar
from ..registry_tools import iso_register


@iso_register('PT')
class Portugal(WesternCalendar):
    'Portugal'

    # Christian holidays
    include_good_friday = True
    include_easter_sunday = True
    include_christmas = True
    include_immaculate_conception = True
    immaculate_conception_label = "Imaculada Conceição"

    # Civil holidays
    include_labour_day = True
    labour_day_label = "Dia do Trabalhador"
    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (4, 25, "Dia da Liberdade"),
        (6, 10, "Dia de Portugal"),
        (8, 15, "Assunção de Nossa Senhora"),
github peopledoc / workalendar / workalendar / africa / madagascar.py View on Github external
from ..core import WesternCalendar
from ..registry_tools import iso_register


@iso_register('MG')
class Madagascar(WesternCalendar):
    "Madagascar"
    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (3, 29, "Martyrs' Day"),
        (6, 26, "Independence Day"),
    )
    # Civil holidays
    include_labour_day = True
    # Christian holidays
    include_easter_monday = True
    include_ascension = True
    include_whit_monday = True
    include_assumption = True
    include_all_saints = True
github peopledoc / workalendar / workalendar / europe / netherlands.py View on Github external
from datetime import date, timedelta
from ..core import WesternCalendar, SUN
from ..registry_tools import iso_register


@iso_register('NL')
class Netherlands(WesternCalendar):
    'Netherlands'

    include_good_friday = True
    include_easter_sunday = True
    include_easter_monday = True
    include_ascension = True
    include_whit_sunday = True
    include_whit_monday = True
    include_boxing_day = True

    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (5, 5, "Liberation Day"),
    )

    def get_king_queen_day(self, year):
        """27 April unless this is a Sunday in which case it is the 26th
github peopledoc / workalendar / workalendar / europe / united_kingdom.py View on Github external
from datetime import date
from ..core import WesternCalendar, MON
from ..registry_tools import iso_register


@iso_register('GB')
class UnitedKingdom(WesternCalendar):
    'United Kingdom'

    include_good_friday = True
    include_easter_sunday = True
    include_easter_monday = True
    include_boxing_day = True
    shift_new_years_day = True
    non_computable_holiday_dict = {
        1973: [(date(1973, 11, 14), "Royal wedding"), ],
        1977: [(date(1977, 6, 7), "Queen’s Silver Jubilee"), ],
        1981: [(date(1981, 7, 29), "Royal wedding"), ],
        1999: [(date(1999, 12, 31), "New Year's Eve"), ],
        2002: [(date(2002, 6, 3), "Queen’s Golden Jubilee"), ],
        2011: [(date(2011, 4, 29), "Royal Wedding"), ],
        2012: [(date(2012, 6, 5), "Queen’s Diamond Jubilee"), ],
    }
github peopledoc / workalendar / workalendar / america / barbados.py View on Github external
@iso_register("BB")
class Barbados(WesternCalendar):
    "Barbados"
    # Civil holidays
    include_labour_day = True
    # Christian holidays
    include_good_friday = True
    include_easter_sunday = True
    include_easter_monday = True
    include_whit_monday = True
    include_boxing_day = True

    # All holiday are shifted if on a Sunday
    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (1, 21, "Errol Barrow Day"),
        (4, 28, "National Heroes Day"),
        (8, 1, "Emancipation Day"),
        (11, 30, "Independance Day"),
    )

    def get_kadooment_day(self, year):
        """
        First Monday of August.
        """
        return (Barbados.get_nth_weekday_in_month(year, 8, MON),
                "Kadooment Day")

    def get_variable_days(self, year):
        """
        Return variable holidays of the Barbados calendar.
github peopledoc / workalendar / workalendar / europe.py View on Github external
def get_first_day_of_summer(self, year):
        """It's the first thursday *after* April, 18th.
        If April the 18th is a thursday, then it jumps to the 24th.
        """
        return WesternCalendar.get_nth_weekday_in_month(
            year, 4, THU,
            start=date(year, 4, 19))