How to use workalendar - 10 common examples

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 / america / canada.py View on Github external
(11, 11, "Remembrance Day"),
    )

    include_good_friday = True

    def get_variable_days(self, year):
        days = super().get_variable_days(year)
        days.extend([
            (self.get_nth_weekday_in_month(year, 8, MON, 3), "Discovery Day"),
            (self.get_victoria_day(year)),
            (self.get_thanksgiving(year)),
        ])
        return days


@iso_register('CA-NT')
class NorthwestTerritories(RemembranceDayShiftMixin, VictoriaDayMixin,
                           ThanksgivingMixin, Canada):
    "Northwest Territories"

    FIXED_HOLIDAYS = Canada.FIXED_HOLIDAYS + (
        (6, 21, "National Aboriginal Day"),
    )

    include_good_friday = True

    def get_variable_days(self, year):
        days = super().get_variable_days(year)
        days.extend([
            (self.get_victoria_day(year)),
            (self.get_thanksgiving(year)),
        ])
github peopledoc / workalendar / workalendar / usa / iowa.py View on Github external
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

from ..registry_tools import iso_register
from .core import UnitedStates


@iso_register('US-IA')
class Iowa(UnitedStates):
    """Iowa"""
    include_thanksgiving_friday = True
    include_columbus_day = False
    include_federal_presidents_day = False
github peopledoc / workalendar / workalendar / america / brazil.py View on Github external
FIXED_HOLIDAYS = Brazil.FIXED_HOLIDAYS + (
        (7, 2, "Independência da Bahia"),
    )


@iso_register('BR-CE')
class BrazilCeara(Brazil):
    "Brazil Ceará State"
    FIXED_HOLIDAYS = Brazil.FIXED_HOLIDAYS + (
        (3, 23, "Data Manga do Ceará"),
        (3, 25, "Aniversário do Ceará"),
    )
    include_sao_jose = True


@iso_register('BR-DF')
class BrazilDistritoFederal(Brazil):
    "Brazil Distrito Federal State"
    FIXED_HOLIDAYS = Brazil.FIXED_HOLIDAYS + (
        (4, 21, "Fundação de Brasília"),
        (11, 30, "Dia do Evangélico"),
    )


@iso_register('BR-ES')
class BrazilEspiritoSanto(Brazil):
    "Brazil Espírito Santo State"
    include_servidor_publico = True


@iso_register('BR-GO')
class BrazilGoias(Brazil):
github peopledoc / workalendar / workalendar / usa / hawaii.py View on Github external
from ..core import FRI
from ..registry_tools import iso_register

from .core import UnitedStates


@iso_register('US-HI')
class Hawaii(UnitedStates):
    """Hawaii"""
    include_good_friday = True
    include_columbus_day = False
    include_election_day_even = True

    FIXED_HOLIDAYS = UnitedStates.FIXED_HOLIDAYS + (
        (3, 26, "Prince Jonah Kuhio Kalanianaole Day"),
        (6, 11, "King Kamehameha Day"),
    )

    def get_statehood_day(self, year):
        """
        Statehood Day: 3rd Friday in August.
        """
        return (
github peopledoc / workalendar / workalendar / europe / latvia.py View on Github external
from datetime import date
from ..core import WesternCalendar
from ..registry_tools import iso_register


@iso_register('LV')
class Latvia(WesternCalendar):
    'Latvia'

    # Civil holidays
    include_labour_day = True
    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (6, 23, "Midsummer Day"),
        (6, 24, "St. John's Day"),
        (11, 18, "Proclamation Day"),
        (12, 31, "New Years Eve"),
    )

    # Christian holidays
    include_good_friday = True
    include_easter_sunday = True
    include_easter_monday = True
github peopledoc / workalendar / workalendar / asia / qatar.py View on Github external
from ..core import Calendar
from ..core import FRI, SAT, IslamicMixin
from ..registry_tools import iso_register


@iso_register('QA')
class Qatar(IslamicMixin, Calendar):
    "Qatar"
    WEEKEND_DAYS = (FRI, SAT)

    FIXED_HOLIDAYS = (
        (12, 18, "National Day"),
    )
    include_start_ramadan = True
    include_eid_al_fitr = True
    length_eid_al_fitr = 4
    include_eid_al_adha = True
    length_eid_al_adha = 4
github peopledoc / workalendar / workalendar / oceania / australia.py View on Github external
)

    def get_melbourne_cup(self, year):
        return (
            Victoria.get_nth_weekday_in_month(year, 11, TUE),
            "Melbourne Cup"
        )

    def get_variable_days(self, year):
        days = super().get_variable_days(year)
        days.append(self.get_labours_day_in_march(year))
        days.append(self.get_melbourne_cup(year))
        return days


@iso_register('AU-WA')
class WesternAustralia(Australia):
    "Western Australia"
    include_boxing_day = True

    def get_labours_day_in_march(self, year):
        return (
            WesternAustralia.get_nth_weekday_in_month(year, 3, MON),
            "Labour Day"
        )

    def get_western_australia_day(self, year):
        return (
            WesternAustralia.get_nth_weekday_in_month(year, 6, MON),
            "Western Australia Day"
        )
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):
github peopledoc / workalendar / workalendar / oceania / australia.py View on Github external
def get_variable_days(self, year):
        days = super().get_variable_days(year)
        days.append(self.get_canberra_day(year))

        family_community_day = self.get_family_community_day(year)
        if family_community_day is not None:
            days.append(family_community_day)

        reconciliation_day = self.get_reconciliation_day(year)
        if reconciliation_day is not None:
            days.append(reconciliation_day)

        return days


@iso_register('AU-NSW')
class NewSouthWales(Australia):
    "New South Wales"
    include_queens_birthday = True
    include_easter_saturday = True
    include_easter_sunday = True
    include_labour_day_october = True
    include_boxing_day = True

    ANZAC_SHIFT_DAYS = (SUN,)


@iso_register('AU-NT')
class NorthernTerritory(Australia):
    "Northern Territory"
    include_easter_saturday = True
    include_queens_birthday = True
github peopledoc / workalendar / workalendar / europe / cyprus.py View on Github external
from datetime import timedelta
from ..core import WesternCalendar
from ..registry_tools import iso_register


@iso_register('CY')
class Cyprus(WesternCalendar):
    'Cyprus'

    # Civil holidays
    include_labour_day = True

    # Christian holidays
    include_epiphany = True
    include_clean_monday = True
    include_good_friday = True
    include_easter_saturday = True
    include_easter_sunday = True
    include_easter_monday = True
    include_whit_monday = True
    whit_monday_label = 'Pentecost Monday'
    include_christmas_eve = True