How to use the workalendar.core.SAT 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 / europe.py View on Github external
def get_midsummer_day(self, year):
        date_eve = Sweden.get_nth_weekday_in_month(
            year, 6, SAT, start=date(year, 6, 20))
        return date_eve
github peopledoc / workalendar / workalendar / america / canada.py View on Github external
def get_boxing_day(self, year):
        boxingday = date(year, 12, 26)
        if boxingday.weekday() == MON:
            days = [(boxingday, "Boxing Day"), (date(year, 12, 27),
                    "Boxing Day (Shift)")]
        elif boxingday.weekday() == SAT or boxingday.weekday() == SUN:
            days = [(boxingday, "Boxing Day"), (date(year, 12, 28),
                    "Boxing Day (Shift)")]
        else:
            days = [(boxingday, "Boxing Day")]
        return days
github peopledoc / workalendar / workalendar / africa / ivory_coast.py View on Github external
include_whit_monday = True
    include_assumption = True
    include_all_saints = True
    # Islamic holidays
    include_day_after_prophet_birthday = True
    include_eid_al_fitr = True
    include_day_of_sacrifice = True
    include_day_of_sacrifice_label = "Feast of the Sacrifice"

    FIXED_HOLIDAYS = IslamoWesternCalendar.FIXED_HOLIDAYS + (
        (8, 7, "Independence Day"),
        (11, 15, "National Peace Day"),
    )

    # Ivory Coast has adopted the "western" workweek.
    WEEKEND_DAYS = (SAT, SUN)
github peopledoc / workalendar / workalendar / usa / georgia.py View on Github external
# Special case: 2011 / Source:
        # Christmas day is SUN, but doesn't follow the same rule as year 2016.
        # https://web.archive.org/web/20110927122533/http://www.georgia.gov/00/channel_modifieddate/0,2096,4802_64437763,00.html  # noqa
        if year == 2011:
            day = date(year, 12, 26)
        elif christmas_day == MON:
            day = date(year, 12, 26)  # TUE
        elif christmas_day == TUE:
            day = date(year, 12, 24)  # MON
        elif christmas_day == WED:
            day = date(year, 12, 24)  # TUE
        elif christmas_day == THU:
            day = date(year, 12, 26)  # FRI
        elif christmas_day == FRI:
            day = date(year, 12, 24)  # THU
        elif christmas_day == SAT:
            day = date(year, 12, 23)  # THU
        else:  # christmas_day == SUN:
            day = date(year, 12, 27)  # FRI
        return (day, self.label_washington_birthday_december)
github peopledoc / workalendar / workalendar / europe / sweden.py View on Github external
def get_midsummer_day(self, year):
        date_eve = Sweden.get_nth_weekday_in_month(
            year, 6, SAT, start=date(year, 6, 20))
        return date_eve
github peopledoc / workalendar / workalendar / oceania / new_zealand.py View on Github external
if waitangi_day.weekday() in self.get_weekend_days():
            days.append((
                self.find_following_working_day(waitangi_day),
                "Waitangi Day Shift")
            )

        anzac_day = date(year, 4, 25)
        if anzac_day.weekday() in self.get_weekend_days():
            days.append((
                self.find_following_working_day(anzac_day),
                "ANZAC Day Shift")
            )

        christmas = date(year, 12, 25)
        boxing_day = date(year, 12, 26)
        if christmas.weekday() is SAT:
            shift = self.find_following_working_day(christmas)
            days.append((shift, "Christmas Shift"))
        elif christmas.weekday() is SUN:
            shift = self.find_following_working_day(christmas)
            days.append((shift + timedelta(days=1), "Christmas Shift"))

        if boxing_day.weekday() is SAT:
            shift = self.find_following_working_day(boxing_day)
            days.append((shift, "Boxing Day Shift"))
        elif boxing_day.weekday() is SUN:
            shift = self.find_following_working_day(boxing_day)
            days.append((shift + timedelta(days=1), "Boxing Day Shift"))

        new_year = date(year, 1, 1)
        day_after_new_year = date(year, 1, 2)
        if new_year.weekday() is SAT:
github peopledoc / workalendar / workalendar / oceania / australia.py View on Github external
from ..core import WesternCalendar, MON, TUE, SAT, SUN
from ..registry_tools import iso_register


@iso_register('AU')
class Australia(WesternCalendar):
    "Australia"
    include_good_friday = True
    include_easter_monday = True
    include_queens_birthday = False
    include_labour_day_october = False
    include_boxing_day = True
    # Shall we shift Anzac Day?
    shift_anzac_day = True

    ANZAC_SHIFT_DAYS = (SAT, SUN)

    FIXED_HOLIDAYS = WesternCalendar.FIXED_HOLIDAYS + (
        (1, 26, "Australia Day"),
    )

    def get_canberra_day(self, year):
        return (
            Australia.get_nth_weekday_in_month(year, 3, MON, 2),
            "Canberra Day"
        )

    def get_queens_birthday(self, year):
        return (
            Australia.get_nth_weekday_in_month(year, 6, MON, 2),
            "Queen's Birthday"
        )
github peopledoc / workalendar / workalendar / europe / cayman_islands.py View on Github external
def get_queens_birthday(self, year):
        """
        Queen's Birthday: On MON after second SAT in June, with exceptions
        """
        saturday = CaymanIslands.get_nth_weekday_in_month(year, 6, SAT, 2)
        holiday = saturday + timedelta(days=2)
        return QUEENS_BIRTHDAY_EXCEPTIONS.get(year, holiday)
github peopledoc / workalendar / workalendar / europe / turkey.py View on Github external
from datetime import timedelta
from ..core import IslamicCalendar, SAT, SUN
from ..registry_tools import iso_register


@iso_register('TR')
class Turkey(IslamicCalendar):
    'Turkey'
    shift_new_years_day = True
    # Even though they're using an islamic calendar, the work week is MON->FRI
    WEEKEND_DAYS = (SAT, SUN)

    # Islamic Holidays
    include_eid_al_fitr = True
    length_eid_al_fitr = 3
    include_eid_al_adha = True
    length_eid_al_adha = 4

    # Civil holidays
    include_labour_day = True
    labour_day_label = "Labor and Solidarity Day"
    FIXED_HOLIDAYS = IslamicCalendar.FIXED_HOLIDAYS + (
        (4, 23, "National Sovereignty and Children's Day"),
        (5, 19, "Commemoration of Atatürk, Youth and Sports Day"),
        (7, 15, "Democracy and National Unity Day"),
        (8, 30, "Victory Day"),
        (10, 29, "Republic Day"),
github peopledoc / workalendar / workalendar / usa / core.py View on Github external
elif day.weekday() == SUN:
                new_holidays.append((day + timedelta(days=1),
                                     label + " (Observed)"))

        # If year+1 January the 1st is on SAT, add the FRI before to observed
        if date(year + 1, 1, 1).weekday() == SAT:
            new_holidays.append((date(year, 12, 31,),
                                 "New Years Day (Observed)"))

        # Special rules for XMas and XMas Eve
        christmas = date(year, 12, 25)
        christmas_eve = date(year, 12, 24)
        # Is XMas eve in your calendar?
        if christmas_eve in holiday_lookup:
            # You are observing the THU before, as an extra XMas Eve
            if christmas.weekday() == SAT:
                # Remove the "fake" XMAS Day shift, the one done before.
                new_holidays.remove(
                    (christmas_eve, "Christmas Day (Observed)")
                )
                new_holidays.append((date(year, 12, 23),
                                     "Christmas Eve (Observed)"))
            # You are observing the 26th (TUE)
            elif christmas.weekday() == MON:
                # Remove the "fake" XMAS Eve shift, done before
                new_holidays.remove(
                    (christmas, "Christmas Eve (Observed)")
                )
                new_holidays.append((date(year, 12, 26),
                                     "Christmas Day (Observed)"))
        return holidays + new_holidays