Skip to content

Instantly share code, notes, and snippets.

@dracos
Created December 24, 2016 20:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dracos/fe482943a391aa170c3115477ecd1f14 to your computer and use it in GitHub Desktop.
Save dracos/fe482943a391aa170c3115477ecd1f14 to your computer and use it in GitHub Desktop.
Days when other festivals overlap Christmas Day
Hanukah
[...]
1902-12-24
1905-12-22
1908-12-18
1910-12-25
1913-12-23
1916-12-19
1921-12-25
1924-12-21
1927-12-18
1932-12-23
1935-12-20
1938-12-17
1940-12-24
1943-12-21
1946-12-17
1951-12-23
1954-12-19
1957-12-17
1959-12-25
1962-12-21
1965-12-18
1970-12-22
1973-12-19
1978-12-24
1981-12-20
1984-12-18
1989-12-22
1992-12-19
1995-12-17
1997-12-23
2000-12-21
2003-12-19
2005-12-25
2008-12-21
2011-12-20
2016-12-24
2019-12-22
2022-12-18
2024-12-25
2027-12-24
2030-12-20
2035-12-25
2038-12-21
2041-12-17
2046-12-23
2049-12-19
2054-12-25
2057-12-21
2060-12-17
2065-12-22
2068-12-18
2073-12-24
2076-12-20
2079-12-17
2084-12-22
2087-12-19
2092-12-23
2095-12-20
2098-12-18
Eid al-Fitr
1707-12-25
1772-12-25
1870-12-24
2098-12-24
Eid al-Adha
1746-12-23
1811-12-25
1909-12-22
1974-12-24
2039-12-25
import convertdate
import datetime
def get_in_year(gregorian_year, calendar, month, day):
day = day - 1
system = getattr(convertdate, calendar)
yearS = system.from_gregorian(gregorian_year, 1, 1)[0]
yearE = system.from_gregorian(gregorian_year, 12, 31)[0]
for year in range(yearS, yearE+1):
out = system.to_gregorian(year, month, day)
if out[0] == gregorian_year:
yield datetime.date(*out)
def overlaps_christmas(event, days, calendar, month, day):
print event
for year in range(1700, 2100+1):
for date in get_in_year(year, calendar, month, day):
if date.month == 12 and 25-days <= date.day <= 25:
print ' ', date
overlaps_christmas('Hanukah', 8, 'hebrew', convertdate.hebrew.KISLEV, 25)
overlaps_christmas('Eid al-Fitr', 1, 'islamic', 10, 1)
overlaps_christmas('Eid al-Adha', 4, 'islamic', 12, 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment