Python dateutil.easter.easter() Examples
The following are 30
code examples of dateutil.easter.easter().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
dateutil.easter
, or try the search function
.
Example #1
Source File: offsets.py From recruit with Apache License 2.0 | 6 votes |
def apply(self, other): current_easter = easter(other.year) current_easter = datetime(current_easter.year, current_easter.month, current_easter.day) current_easter = conversion.localize_pydatetime(current_easter, other.tzinfo) n = self.n if n >= 0 and other < current_easter: n -= 1 elif n < 0 and other > current_easter: n += 1 # TODO: Why does this handle the 0 case the opposite of others? # NOTE: easter returns a datetime.date so we have to convert to type of # other new = easter(other.year + n) new = datetime(new.year, new.month, new.day, other.hour, other.minute, other.second, other.microsecond) return new
Example #2
Source File: austria.py From python-holidays with MIT License | 6 votes |
def _populate(self, year): # public holidays self[date(year, JAN, 1)] = "Neujahr" self[date(year, JAN, 6)] = "Heilige Drei Könige" self[easter(year) + rd(weekday=MO)] = "Ostermontag" self[date(year, MAY, 1)] = "Staatsfeiertag" self[easter(year) + rd(days=39)] = "Christi Himmelfahrt" self[easter(year) + rd(days=50)] = "Pfingstmontag" self[easter(year) + rd(days=60)] = "Fronleichnam" self[date(year, AUG, 15)] = "Mariä Himmelfahrt" if 1919 <= year <= 1934: self[date(year, NOV, 12)] = "Nationalfeiertag" if year >= 1967: self[date(year, OCT, 26)] = "Nationalfeiertag" self[date(year, NOV, 1)] = "Allerheiligen" self[date(year, DEC, 8)] = "Mariä Empfängnis" self[date(year, DEC, 25)] = "Christtag" self[date(year, DEC, 26)] = "Stefanitag"
Example #3
Source File: finland.py From python-holidays with MIT License | 6 votes |
def _populate(self, year): e = easter(year) self[date(year, JAN, 1)] = "Uudenvuodenpäivä" self[date(year, JAN, 6)] = "Loppiainen" self[e - rd(days=2)] = "Pitkäperjantai" self[e] = "Pääsiäispäivä" self[e + rd(days=1)] = "2. pääsiäispäivä" self[date(year, MAY, 1)] = "Vappu" self[e + rd(days=39)] = "Helatorstai" self[e + rd(days=49)] = "Helluntaipäivä" self[date(year, JUN, 20) + rd(weekday=SA)] = "Juhannuspäivä" self[date(year, OCT, 31) + rd(weekday=SA)] = "Pyhäinpäivä" self[date(year, DEC, 6)] = "Itsenäisyyspäivä" self[date(year, DEC, 25)] = "Joulupäivä" self[date(year, DEC, 26)] = "Tapaninpäivä" # Juhannusaatto (Midsummer Eve) and Jouluaatto (Christmas Eve) are not # official holidays, but are de facto. self[date(year, JUN, 19) + rd(weekday=FR)] = "Juhannusaatto" self[date(year, DEC, 24)] = "Jouluaatto"
Example #4
Source File: iceland.py From python-holidays with MIT License | 6 votes |
def _populate(self, year): # Public holidays self[date(year, JAN, 1)] = "Nýársdagur" self[easter(year) - rd(days=3)] = "Skírdagur" self[easter(year) + rd(weekday=FR(-1))] = "Föstudagurinn langi" self[easter(year)] = "Páskadagur" self[easter(year) + rd(days=1)] = "Annar í páskum" self[date(year, APR, 19) + rd(weekday=TH(+1))] = \ "Sumardagurinn fyrsti" self[date(year, MAY, 1)] = "Verkalýðsdagurinn" self[easter(year) + rd(days=39)] = "Uppstigningardagur" self[easter(year) + rd(days=49)] = "Hvítasunnudagur" self[easter(year) + rd(days=50)] = "Annar í hvítasunnu" self[date(year, JUN, 17)] = "Þjóðhátíðardagurinn" # First Monday of August self[date(year, AUG, 1) + rd(weekday=MO(+1))] = \ "Frídagur verslunarmanna" self[date(year, DEC, 24)] = "Aðfangadagur" self[date(year, DEC, 25)] = "Jóladagur" self[date(year, DEC, 26)] = "Annar í jólum" self[date(year, DEC, 31)] = "Gamlársdagur"
Example #5
Source File: poland.py From python-holidays with MIT License | 6 votes |
def _populate(self, year): self[date(year, JAN, 1)] = 'Nowy Rok' if year >= 2011: self[date(year, JAN, 6)] = 'Święto Trzech Króli' e = easter(year) self[e] = 'Niedziela Wielkanocna' self[e + rd(days=1)] = 'Poniedziałek Wielkanocny' if year >= 1950: self[date(year, MAY, 1)] = 'Święto Państwowe' if year >= 1919: self[date(year, MAY, 3)] = 'Święto Narodowe Trzeciego Maja' self[e + rd(days=49)] = 'Zielone Świątki' self[e + rd(days=60)] = 'Dzień Bożego Ciała' self[date(year, AUG, 15)] = 'Wniebowzięcie Najświętszej Marii Panny' self[date(year, NOV, 1)] = 'Uroczystość Wszystkich świętych' if (1937 <= year <= 1945) or year >= 1989: self[date(year, NOV, 11)] = 'Narodowe Święto Niepodległości' self[date(year, DEC, 25)] = 'Boże Narodzenie (pierwszy dzień)' self[date(year, DEC, 26)] = 'Boże Narodzenie (drugi dzień)'
Example #6
Source File: offsets.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def apply(self, other): currentEaster = easter(other.year) currentEaster = datetime( currentEaster.year, currentEaster.month, currentEaster.day) currentEaster = tslib._localize_pydatetime(currentEaster, other.tzinfo) # NOTE: easter returns a datetime.date so we have to convert to type of # other if self.n >= 0: if other >= currentEaster: new = easter(other.year + self.n) else: new = easter(other.year + self.n - 1) else: if other > currentEaster: new = easter(other.year + self.n + 1) else: new = easter(other.year + self.n) new = datetime(new.year, new.month, new.day, other.hour, other.minute, other.second, other.microsecond) return new
Example #7
Source File: offsets.py From elasticintel with GNU General Public License v3.0 | 6 votes |
def apply(self, other): currentEaster = easter(other.year) currentEaster = datetime( currentEaster.year, currentEaster.month, currentEaster.day) currentEaster = tslib._localize_pydatetime(currentEaster, other.tzinfo) # NOTE: easter returns a datetime.date so we have to convert to type of # other if self.n >= 0: if other >= currentEaster: new = easter(other.year + self.n) else: new = easter(other.year + self.n - 1) else: if other > currentEaster: new = easter(other.year + self.n + 1) else: new = easter(other.year + self.n) new = datetime(new.year, new.month, new.day, other.hour, other.minute, other.second, other.microsecond) return new
Example #8
Source File: offsets.py From coffeegrindsize with MIT License | 6 votes |
def apply(self, other): current_easter = easter(other.year) current_easter = datetime(current_easter.year, current_easter.month, current_easter.day) current_easter = conversion.localize_pydatetime(current_easter, other.tzinfo) n = self.n if n >= 0 and other < current_easter: n -= 1 elif n < 0 and other > current_easter: n += 1 # TODO: Why does this handle the 0 case the opposite of others? # NOTE: easter returns a datetime.date so we have to convert to type of # other new = easter(other.year + n) new = datetime(new.year, new.month, new.day, other.hour, other.minute, other.second, other.microsecond) return new
Example #9
Source File: offsets.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 6 votes |
def apply(self, other): current_easter = easter(other.year) current_easter = datetime(current_easter.year, current_easter.month, current_easter.day) current_easter = conversion.localize_pydatetime(current_easter, other.tzinfo) n = self.n if n >= 0 and other < current_easter: n -= 1 elif n < 0 and other > current_easter: n += 1 # TODO: Why does this handle the 0 case the opposite of others? # NOTE: easter returns a datetime.date so we have to convert to type of # other new = easter(other.year + n) new = datetime(new.year, new.month, new.day, other.hour, other.minute, other.second, other.microsecond) return new
Example #10
Source File: offsets.py From twitter-stock-recommendation with MIT License | 6 votes |
def apply(self, other): current_easter = easter(other.year) current_easter = datetime(current_easter.year, current_easter.month, current_easter.day) current_easter = tslib._localize_pydatetime(current_easter, other.tzinfo) n = self.n if n >= 0 and other < current_easter: n -= 1 elif n < 0 and other > current_easter: n += 1 # TODO: Why does this handle the 0 case the opposite of others? # NOTE: easter returns a datetime.date so we have to convert to type of # other new = easter(other.year + n) new = datetime(new.year, new.month, new.day, other.hour, other.minute, other.second, other.microsecond) return new
Example #11
Source File: offsets.py From vnpy_crypto with MIT License | 6 votes |
def apply(self, other): current_easter = easter(other.year) current_easter = datetime(current_easter.year, current_easter.month, current_easter.day) current_easter = tslib._localize_pydatetime(current_easter, other.tzinfo) n = self.n if n >= 0 and other < current_easter: n -= 1 elif n < 0 and other > current_easter: n += 1 # TODO: Why does this handle the 0 case the opposite of others? # NOTE: easter returns a datetime.date so we have to convert to type of # other new = easter(other.year + n) new = datetime(new.year, new.month, new.day, other.hour, other.minute, other.second, other.microsecond) return new
Example #12
Source File: offsets.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def onOffset(self, dt): if self.normalize and not _is_normalized(dt): return False return date(dt.year, dt.month, dt.day) == easter(dt.year) # --------------------------------------------------------------------- # Ticks
Example #13
Source File: offsets.py From coffeegrindsize with MIT License | 5 votes |
def onOffset(self, dt): if self.normalize and not _is_normalized(dt): return False return date(dt.year, dt.month, dt.day) == easter(dt.year) # --------------------------------------------------------------------- # Ticks
Example #14
Source File: offsets.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def onOffset(self, dt): if self.normalize and not _is_normalized(dt): return False return date(dt.year, dt.month, dt.day) == easter(dt.year) # --------------------------------------------------------------------- # Ticks
Example #15
Source File: serbia.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): # New Year's Day name = "Нова година" self[date(year, JAN, 1)] = name self[date(year, JAN, 2)] = name if self.observed and date(year, JAN, 1).weekday() in WEEKEND: self[date(year, JAN, 3)] = name + " (Observed)" # Orthodox Christmas name = "Божић" self[date(year, JAN, 7)] = name # Statehood day name = "Дан државности Србије" self[date(year, FEB, 15)] = name self[date(year, FEB, 16)] = name if self.observed and date(year, FEB, 15).weekday() in WEEKEND: self[date(year, FEB, 17)] = name + " (Observed)" # International Workers' Day name = "Празник рада" self[date(year, MAY, 1)] = name self[date(year, MAY, 2)] = name if self.observed and date(year, MAY, 1).weekday() in WEEKEND: self[date(year, MAY, 3)] = name + " (Observed)" # Armistice day name = "Дан примирја у Првом светском рату" self[date(year, NOV, 11)] = name if self.observed and date(year, NOV, 11).weekday() == SUN: self[date(year, NOV, 12)] = name + " (Observed)" # Easter self[easter(year, method=EASTER_ORTHODOX) - rd(days=2)] = \ "Велики петак" self[easter(year, method=EASTER_ORTHODOX) - rd(days=1)] = \ "Велика субота" self[easter(year, method=EASTER_ORTHODOX)] = "Васкрс" self[easter(year, method=EASTER_ORTHODOX) + rd(days=1)] = \ "Други дан Васкрса"
Example #16
Source File: offsets.py From twitter-stock-recommendation with MIT License | 5 votes |
def onOffset(self, dt): if self.normalize and not _is_normalized(dt): return False return date(dt.year, dt.month, dt.day) == easter(dt.year) # --------------------------------------------------------------------- # Ticks
Example #17
Source File: offsets.py From recruit with Apache License 2.0 | 5 votes |
def onOffset(self, dt): if self.normalize and not _is_normalized(dt): return False return date(dt.year, dt.month, dt.day) == easter(dt.year) # --------------------------------------------------------------------- # Ticks
Example #18
Source File: nicaragua.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): # New Years self[date(year, JAN, 1)] = "Año Nuevo [New Year's Day]" # Maundy Thursday self[easter(year) + rd(weekday=TH(-1))] =\ "Jueves Santo [Maundy Thursday]" # Good Friday self[easter(year) + rd(weekday=FR(-1))] = "Viernes Santo [Good Friday]" # Labor Day self[date(year, MAY, 1)] = "Día del Trabajo [Labour Day]" # Revolution Day if 2020 >= year >= 1979: self[date(year, JUL, 19)] = "Día de la Revolución [Revolution Day]" # Battle of San Jacinto Day self[date(year, SEP, 14)] =\ "Batalla de San Jacinto [Battle of San Jacinto]" # Independence Day self[date(year, SEP, 15)] =\ "Día de la Independencia [Independence Day]" # Virgin's Day self[date(year, DEC, 8)] = "Concepción de María [Virgin's Day]" # Christmas self[date(year, DEC, 25)] = "Navidad [Christmas]" # Provinces festive day if self.prov: if self.prov == 'MN': # Santo Domingo Day Down self[date(year, AUG, 1)] = "Bajada de Santo Domingo" # Santo Domingo Day Up self[date(year, AUG, 10)] = "Subida de Santo Domingo"
Example #19
Source File: estonia.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): e = easter(year) # New Year's Day self[date(year, JAN, 1)] = "uusaasta" # Independence Day, anniversary of the Republic of Estonia self[date(year, FEB, 24)] = "iseseisvuspäev" # Good Friday self[e - rd(days=2)] = "suur reede" # Easter Sunday self[e] = "ülestõusmispühade 1. püha" # Spring Day self[date(year, MAY, 1)] = "kevadpüha" # Pentecost self[e + rd(days=49)] = "nelipühade 1. püha" # Victory Day self[date(year, JUN, 23)] = "võidupüha" # Midsummer Day self[date(year, JUN, 24)] = "jaanipäev" # Day of Restoration of Independence self[date(year, AUG, 20)] = "taasiseseisvumispäev" # Christmas Eve self[date(year, DEC, 24)] = "jõululaupäev" # Christmas Day self[date(year, DEC, 25)] = "esimene jõulupüha" # Boxing Day self[date(year, DEC, 26)] = "teine jõulupüha"
Example #20
Source File: slovakia.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): self[date(year, JAN, 1)] = "Deň vzniku Slovenskej republiky" self[date(year, JAN, 6)] = "Zjavenie Pána (Traja králi a" \ " vianočnýsviatok pravoslávnych" \ " kresťanov)" e = easter(year) self[e - rd(days=2)] = "Veľký piatok" self[e + rd(days=1)] = "Veľkonočný pondelok" self[date(year, MAY, 1)] = "Sviatok práce" if year >= 1997: self[date(year, MAY, 8)] = "Deň víťazstva nad fašizmom" self[date(year, JUL, 5)] = "Sviatok svätého Cyrila a svätého Metoda" self[date(year, AUG, 29)] = "Výročie Slovenského národného" \ " povstania" self[date(year, SEP, 1)] = "Deň Ústavy Slovenskej republiky" self[date(year, SEP, 15)] = "Sedembolestná Panna Mária" if year == 2018: self[date(year, OCT, 30)] = "100. výročie prijatia" \ " Deklarácie slovenského národa" self[date(year, NOV, 1)] = "Sviatok Všetkých svätých" if year >= 2001: self[date(year, NOV, 17)] = "Deň boja za slobodu a demokraciu" self[date(year, DEC, 24)] = "Štedrý deň" self[date(year, DEC, 25)] = "Prvý sviatok vianočný" self[date(year, DEC, 26)] = "Druhý sviatok vianočný"
Example #21
Source File: luxembourg.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): # Public holidays self[date(year, JAN, 1)] = "Neijoerschdag" self[easter(year) + rd(weekday=MO)] = "Ouschterméindeg" self[date(year, MAY, 1)] = "Dag vun der Aarbecht" if year >= 2019: # Europe Day: not in legislation yet, but introduced starting 2019 self[date(year, MAY, 9)] = "Europadag" self[easter(year) + rd(days=39)] = "Christi Himmelfaart" self[easter(year) + rd(days=50)] = "Péngschtméindeg" self[date(year, JUN, 23)] = "Nationalfeierdag" self[date(year, AUG, 15)] = "Léiffrawëschdag" self[date(year, NOV, 1)] = "Allerhellgen" self[date(year, DEC, 25)] = "Chrëschtdag" self[date(year, DEC, 26)] = "Stiefesdag"
Example #22
Source File: denmark.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): # Public holidays self[date(year, JAN, 1)] = "Nytårsdag" self[easter(year) + rd(weekday=SU(-2))] = "Palmesøndag" self[easter(year) + rd(weekday=TH(-1))] = "Skærtorsdag" self[easter(year) + rd(weekday=FR(-1))] = "Langfredag" self[easter(year)] = "Påskedag" self[easter(year) + rd(weekday=MO)] = "Anden påskedag" self[easter(year) + rd(weekday=FR(+4))] = "Store bededag" self[easter(year) + rd(days=39)] = "Kristi himmelfartsdag" self[easter(year) + rd(days=49)] = "Pinsedag" self[easter(year) + rd(days=50)] = "Anden pinsedag" self[date(year, DEC, 25)] = "Juledag" self[date(year, DEC, 26)] = "Anden juledag"
Example #23
Source File: hdays.py From prophet with MIT License | 5 votes |
def _populate(self, year): # New Year's Day name = "New Year's Day" self[date(year, 1, 1)] = name # Orthodox Christmas day name = "Orthodox Christmas Day" self[date(year, 1, 7)] = name # International Women's Day name = "International Women's Day" self[date(year, 3, 8)] = name # Commemoration Day name = "Commemoration Day" self[easter(year, EASTER_ORTHODOX) + timedelta(days=9)] = name # Spring and Labour Day name = "Spring and Labour Day" self[date(year, 5, 1)] = name # Victory Day name = "Victory Day" self[date(year, 5, 9)] = name # Independence Day name = "Independence Day" self[date(year, 7, 3)] = name # October Revolution Day name = "October Revolution Day" self[date(year, 11, 7)] = name # Dec. 25 Christmas Day name = "Christmas Day" self[date(year, 12, 25)] = name
Example #24
Source File: belgium.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): # New years self[date(year, JAN, 1)] = "Nieuwjaarsdag" easter_date = easter(year) # Easter self[easter_date] = "Pasen" # Second easter day self[easter_date + rd(days=1)] = "Paasmaandag" # Ascension day self[easter_date + rd(days=39)] = "O.L.H. Hemelvaart" # Pentecost self[easter_date + rd(days=49)] = "Pinksteren" # Pentecost monday self[easter_date + rd(days=50)] = "Pinkstermaandag" # International Workers' Day self[date(year, MAY, 1)] = "Dag van de Arbeid" # Belgian National Day self[date(year, JUL, 21)] = "Nationale feestdag" # Assumption of Mary self[date(year, AUG, 15)] = "O.L.V. Hemelvaart" # All Saints' Day self[date(year, NOV, 1)] = "Allerheiligen" # Armistice Day self[date(year, NOV, 11)] = "Wapenstilstand" # First christmas self[date(year, DEC, 25)] = "Kerstmis"
Example #25
Source File: offsets.py From vnpy_crypto with MIT License | 5 votes |
def onOffset(self, dt): if self.normalize and not _is_normalized(dt): return False return date(dt.year, dt.month, dt.day) == easter(dt.year) # --------------------------------------------------------------------- # Ticks
Example #26
Source File: european_central_bank.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): self[date(year, JAN, 1)] = "New Year's Day" e = easter(year) self[e - rd(days=2)] = "Good Friday" self[e + rd(days=1)] = "Easter Monday" self[date(year, MAY, 1)] = "1 May (Labour Day)" self[date(year, DEC, 25)] = "Christmas Day" self[date(year, DEC, 26)] = "26 December"
Example #27
Source File: offsets.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def onOffset(self, dt): if self.normalize and not _is_normalized(dt): return False return date(dt.year, dt.month, dt.day) == easter(dt.year) # --------------------------------------------------------------------- # Ticks
Example #28
Source File: exchange_calendar_asex.py From trading_calendars with Apache License 2.0 | 5 votes |
def orthodox_easter(start_date='1980', end_date='2021'): """ ASEX observes Orthodox Easter, and has many holidays that are relative to Orthodox Easter. This function gives a DatetimeIndex of Orthodox Easter dates from start_date to end_date """ return pd.to_datetime([ easter(year, method=EASTER_ORTHODOX) for year in range(int(start_date), int(end_date)) ]).tz_localize(UTC)
Example #29
Source File: czechia.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): self[date(year, JAN, 1)] = "Den obnovy samostatného českého" \ " státu" \ if year >= 2000 else \ "Nový rok" e = easter(year) if year <= 1951 or year >= 2016: self[e - rd(days=2)] = "Velký pátek" self[e + rd(days=1)] = "Velikonoční pondělí" if year >= 1951: self[date(year, MAY, 1)] = "Svátek práce" if year >= 1992: self[date(year, MAY, 8)] = "Den vítězství" elif year >= 1947: self[date(year, MAY, 9)] = "Den vítězství nad hitlerovským" \ " fašismem" if year >= 1951: self[date(year, JUL, 5)] = "Den slovanských věrozvěstů " \ "Cyrila a Metoděje" self[date(year, JUL, 6)] = "Den upálení mistra Jana Husa" if year >= 2000: self[date(year, SEP, 28)] = "Den české státnosti" if year >= 1951: self[date(year, OCT, 28)] = "Den vzniku samostatného " \ "československého státu" if year >= 1990: self[date(year, NOV, 17)] = "Den boje za svobodu a demokracii" if year >= 1990: self[date(year, DEC, 24)] = "Štědrý den" if year >= 1951: self[date(year, DEC, 25)] = "1. svátek vánoční" self[date(year, DEC, 26)] = "2. svátek vánoční"
Example #30
Source File: portugal.py From python-holidays with MIT License | 5 votes |
def _populate(self, year): super(PortugalExt, self)._populate(year) e = easter(year) self[e - rd(days=47)] = "Carnaval" self[date(year, DEC, 24)] = "Véspera de Natal" self[date(year, DEC, 26)] = "26 de Dezembro" self[date(year, DEC, 31)] = "Véspera de Ano Novo" self[date(year, 6, 13)] = "Dia de Santo António" # TODO add bridging days # - get Holidays that occur on Tuesday and add Monday (-1 day) # - get Holidays that occur on Thursday and add Friday (+1 day)