How to use the workalendar.core.MON 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 / oceania / australia.py View on Github external
def get_labour_day_october(self, year):
        return (
            Australia.get_nth_weekday_in_month(year, 10, MON),
            'Labour Day'
        )
github peopledoc / workalendar / workalendar / oceania / australia.py View on Github external
def get_adelaides_cup(self, year):
        return (
            SouthAustralia.get_nth_weekday_in_month(year, 3, MON, 2),
            "Adelaide's cup"
        )
github peopledoc / workalendar / workalendar / usa.py View on Github external
def get_variable_days(self, year):
        days = super(Alaska, self).get_variable_days(year)
        days = self.float(days)
        days.append(
            (Alabama.get_last_weekday_in_month(year, 3, MON), "Seward's Day")
        )
        return days
github peopledoc / workalendar / workalendar / asia / japan.py View on Github external
def get_variable_days(self, year):
        # usual variable days
        days = super().get_variable_days(year)
        equinoxes = calculate_equinoxes(year, 'Asia/Tokyo')
        coming_of_age_day = Japan.get_nth_weekday_in_month(year, 1, MON, 2)
        marine_day = Japan.get_nth_weekday_in_month(year, 7, MON, 3)
        respect_for_the_aged = Japan.get_nth_weekday_in_month(year, 9, MON, 3)
        health_and_sport = Japan.get_nth_weekday_in_month(year, 10, MON, 2)
        days.extend([
            (coming_of_age_day, 'Coming of Age Day'),
            (marine_day, "Marine Day"),
            (equinoxes[0], "Vernal Equinox Day"),
            (respect_for_the_aged, "Respect-for-the-Aged Day"),
            (equinoxes[1], "Autumnal Equinox Day"),
            (health_and_sport, "Health and Sports Day"),
        ])

        # Marine Day is on a Thursday in 2020 for some year
        # https://www.timeanddate.com/holidays/japan/sea-day
        # Health and Sports Day will continue on the 2nd monday
        # of October, except in 2020 when it will happen in July
        # https://www.timeanddate.com/holidays/japan/sports-day
github peopledoc / workalendar / workalendar / europe / iceland.py View on Github external
def get_commerce_day(self, year):
        return Iceland.get_nth_weekday_in_month(year, 8, MON)
github peopledoc / workalendar / workalendar / oceania / australia.py View on Github external
def get_eight_hours_day(self, year):
        return (
            Tasmania.get_nth_weekday_in_month(year, 3, MON, 2),
            "Eight hours Day"
        )
github peopledoc / workalendar / workalendar / america / argentina.py View on Github external
def get_soberania_day(self, year):
        """
        Día de la Soberanía Nacional

        Happens on the 3rd MON of November after the first Friday.
        """
        first_friday_november = Argentina.get_nth_weekday_in_month(
            year, 11, FRI, 1
        )

        soberania_day = Argentina.get_nth_weekday_in_month(
            year, 11, MON, n=3, start=first_friday_november
        )

        return (soberania_day, "Día de la Soberanía Nacional")
github peopledoc / workalendar / workalendar / usa / georgia.py View on Github external
def get_confederate_day(self, year):
        """
        Confederate memorial day is on the 4th MON of April.

        Exception: Year 2020, when it happened on April 10th.
        """
        if year >= 2016:
            label = "State Holiday"
        else:
            label = "Confederate Memorial Day"

        # At the moment, it's the only exception we know about.
        if year == 2020:
            return (date(year, 4, 10), label)

        day = self.get_nth_weekday_in_month(year, 4, MON, 4)
        return (day, label)
github peopledoc / workalendar / workalendar / africa / south_africa.py View on Github external
days.append(self.get_easter_monday_or_family_day(year))

        # Workers day was first friday of may 1987-1989
        if 1987 <= year <= 1989:
            days.append(
                (self.get_nth_weekday_in_month(year, 5, FRI), "Workers' Day")
            )

        if year <= 1993:
            days.append((self.get_ascension_thursday(year), "Ascension Day"))

        # Queen's Birthday on the 2nd Monday of july 1952-1960
        if 1952 <= year <= 1960:
            days.append((
                self.get_nth_weekday_in_month(year, 7, MON, 2),
                "Queen's Birthday"
            ))

        # King's Birthday on the first Monday of August 1910-1951
        if 1910 <= year <= 1951:
            days.append((
                self.get_nth_weekday_in_month(year, 8, MON),
                "King's Birthday"
            ))

        if year >= 1952 and year <= 1979:
            days.append((self.get_nth_weekday_in_month(year, 9, MON),
                         "Settlers' Day"))
        return days
github peopledoc / workalendar / workalendar / usa / indiana.py View on Github external
def get_primary_election_day(self, year):
        """
        Return the Primary Election Day

        FIXME: Wikipedia says it's a floating MON, but other sources say it's
        "the first Tuesday after the first Monday of May and every two years
        thereafter".
        """
        first_monday_may = self.get_nth_weekday_in_month(year, 5, MON)
        tuesday_after = self.get_nth_weekday_in_month(
            year, 5, TUE, start=first_monday_may)
        return (
            tuesday_after,
            "Primary Election Day"
        )