Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Day of Ashura
# 10th day of 1st Islamic month
name = "Day of Ashura"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 10, 1)[0]
y, m, d = to_gregorian(islam_year, 1, 10)
if y == year:
self[date(y, m, d)] = name
# Mawlid, Birth of the Prophet
# 12th day of 3rd Islamic month
name = "Mawlid"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 11, 20)[0]
y, m, d = to_gregorian(islam_year, 3, 12)
if y == year:
self[date(y, m, d)] = name
# Eid ul-Fitr
# 1st and 2nd day of 10th Islamic month
name = "Eid al-Fitr"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 6, 15)[0]
y1, m1, d1 = to_gregorian(islam_year, 10, 1)
y2, m2, d2 = to_gregorian(islam_year, 10, 2)
if y1 == year:
self[date(y1, m1, d1)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
# Eid al-Adha, i.e., Feast of the Sacrifice
if y == year:
self[date(y, m, d)] = name
# Islamic New Year
name = "Islamic New Year"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 9, 11)[0]
y, m, d = to_gregorian(islam_year + 1, 1, 1)
if y == year:
self[date(y, m, d)] = name
# Birth of the Prophet
name = "Birth of the Prophet"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 11, 20)[0]
y, m, d = to_gregorian(islam_year + 1, 3, 12)
if y == year:
self[date(y, m, d)] = name
# Christmas
self[date(year, 12, 25)] = "Christmas"
# Mawlid, Birth of the Prophet
# 12th day of 3rd Islamic month
name = "Mawlid"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 11, 20)[0]
y, m, d = to_gregorian(islam_year, 3, 12)
if y == year:
self[date(y, m, d)] = name
# Day of Ashura
# 10th and 11th days of 1st Islamic month
name = "Day of Ashura"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 10, 1)[0]
y1, m1, d1 = to_gregorian(islam_year, 1, 10)
y2, m2, d2 = to_gregorian(islam_year, 1, 11)
if y1 == year:
self[date(y1, m1, d1)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
# Shab e Mairaj
name = "Shab e Mairaj"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 4, 13)[0]
y, m, d = to_gregorian(islam_year, 7, 27)
if y == year:
self[date(y, m, d)] = name
# Defence Day
name = "Defence Day"
self[date(year, 9, 6)] = name
# 12th day of 3rd Islamic month
name = "Birth of Prophet"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 11, 20)[0]
y, m, d = to_gregorian(islam_year, 3, 12)
if y == year:
self[date(y, m, d)] = name
# Eid ul-Fitr
# 1st and 2nd day of 10th Islamic month
name = "Eid al-Fitr"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 6, 15)[0]
y1, m1, d1 = to_gregorian(islam_year, 10, 1)
y2, m2, d2 = to_gregorian(islam_year, 10, 2)
y3, m3, d3 = to_gregorian(islam_year, 10, 3)
if y1 == year:
self[date(y1, m1, d1)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
if y3 == year:
self[date(y3, m3, d3)] = name
# Eid al-Adha, i.e., Feast of the Sacrifice
name = "Feast of the Sacrifice"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 8, 22)[0]
y1, m1, d1 = to_gregorian(islam_year, 12, 10)
y2, m2, d2 = to_gregorian(islam_year, 12, 11)
y3, m3, d3 = to_gregorian(islam_year, 12, 12)
y4, m4, d4 = to_gregorian(islam_year, 12, 13)
if y1 == year:
# Mawlid, Birth of the Prophet
# 12th day of 3rd Islamic month
name = "Mawlid"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 11, 20)[0]
y, m, d = to_gregorian(islam_year, 3, 12)
if y == year:
self[date(y, m, d)] = name
# Day of Ashura
# 10th and 11th days of 1st Islamic month
name = "Day of Ashura"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 10, 1)[0]
y1, m1, d1 = to_gregorian(islam_year, 1, 10)
y2, m2, d2 = to_gregorian(islam_year, 1, 11)
if y1 == year:
self[date(y1, m1, d1)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
# Shab e Mairaj
name = "Shab e Mairaj"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 4, 13)[0]
y, m, d = to_gregorian(islam_year, 7, 27)
if y == year:
self[date(y, m, d)] = name
# Defence Day
name = "Defence Day"
y3, m3, d3 = to_gregorian(islam_year, 10, 3)
if y1 == year:
self[date(y1, m1, d1)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
if y3 == year:
self[date(y3, m3, d3)] = name
# Eid al-Adha, i.e., Feast of the Sacrifice
name = "Feast of the Sacrifice"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 8, 22)[0]
y1, m1, d1 = to_gregorian(islam_year, 12, 10)
y2, m2, d2 = to_gregorian(islam_year, 12, 11)
y3, m3, d3 = to_gregorian(islam_year, 12, 12)
y4, m4, d4 = to_gregorian(islam_year, 12, 13)
if y1 == year:
self[date(y1, m1, d1)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
if y3 == year:
self[date(y3, m3, d3)] = name
if y4 == year:
self[date(y4, m4, d4)] = name
# Iqbal Day
name = "Iqbal Day"
self[date(year, 11, 9)] = name
# Christmas Day
# Also birthday of PK founder
name = "Christmas Day"
self[date(year, 12, 25)] = name
# Eid al-Adha, i.e., Feast of the Sacrifice
name = "Feast of the Sacrifice"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 8, 22)[0]
y1, m1, d1 = to_gregorian(islam_year, 12, 10)
y2, m2, d2 = to_gregorian(islam_year, 12, 11)
y3, m3, d3 = to_gregorian(islam_year, 12, 12)
if y1 == year:
self[date(y1, m1, d1)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
if y3 == year:
self[date(y3, m3, d3)] = name
# Eid al-Fitr
name = "Eid al-Fitr"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 6, 15)[0]
y1, m1, d1 = to_gregorian(islam_year, 10, 1)
y2, m2, d2 = to_gregorian(islam_year, 10, 2)
y3, m3, d3 = to_gregorian(islam_year, 10, 3)
if y1 == year:
for offset in range(-1, 2, 1):
ds = Converter.Lunar2Solar(Lunar(year + offset, 4, 15)).to_date()
if ds.year == year:
self[ds] = name
# Pancasila Day, since 2017
if year >= 2017:
name = "Pancasila Day"
self[date(year, 6, 1)] = name
# Eid al-Fitr
name = "Eid al-Fitr"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 6, 15)[0]
y1, m1, d1 = to_gregorian(islam_year, 10, 1)
y2, m2, d2 = to_gregorian(islam_year, 10, 2)
if y1 == year:
self[date(y1, m2, d2)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
# Independence Day
name = "Independence Day"
self[date(year, 8, 17)] = name
# Feast of the Sacrifice
name = "Feast of the Sacrifice"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 8, 22)[0]
y, m, d = to_gregorian(islam_year, 12, 10)
if y == year:
self[date(y, m, d)] = name
name = "Malaysia Day"
self[date(year, 9, 16)] = name
# Feast of the Sacrifice
name = "Feast of the Sacrifice"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 8, 22)[0]
y, m, d = to_gregorian(islam_year, 12, 10)
if y == year:
self[date(y, m, d)] = name
# First Day of Muharram
name = "First Day of Muharram"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 9, 11)[0]
y, m, d = to_gregorian(islam_year + 1, 1, 1)
if y == year:
self[date(y, m, d)] = name
# Christmas
name = "Christmas Day"
self[date(year, 12, 25)] = name
# Iqbal Day
name = "Iqbal Day"
self[date(year, 11, 9)] = name
# Christmas Day
# Also birthday of PK founder
name = "Christmas Day"
self[date(year, 12, 25)] = name
# Eid al-Adha, i.e., Feast of the Sacrifice
name = "Feast of the Sacrifice"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 8, 22)[0]
y1, m1, d1 = to_gregorian(islam_year, 12, 10)
y2, m2, d2 = to_gregorian(islam_year, 12, 11)
y3, m3, d3 = to_gregorian(islam_year, 12, 12)
if y1 == year:
self[date(y1, m1, d1)] = name
if y2 == year:
self[date(y2, m2, d2)] = name
if y3 == year:
self[date(y3, m3, d3)] = name
# Eid al-Fitr
name = "Eid al-Fitr"
for offset in range(-1, 2, 1):
islam_year = from_gregorian(year + offset, 6, 15)[0]
y1, m1, d1 = to_gregorian(islam_year, 10, 1)
y2, m2, d2 = to_gregorian(islam_year, 10, 2)
y3, m3, d3 = to_gregorian(islam_year, 10, 3)
if y1 == year:
self[date(y1, m1, d1)] = name