python-holidays icon indicating copy to clipboard operation
python-holidays copied to clipboard

Implementation of `_IslamicMabimsLunar` for Improved Islamic Holiday Calculations among ASEAN countries

Open PPsyrius opened this issue 1 year ago • 11 comments

From a discussion in #2332

Our default Islamic calendar implementation (Saudi Arabia's Umm al-Qura) has the 2025 Eid'l Fitr estimated date as MAR, 30, unlike the Philippines-based tentative date of MAR, 31 - which is why I want to get this fix out before the next release cycle.

Long term-wise we might want to consider pre-filling ASEAN countries Islamic holiday data though since their tentative date is often very different from Arab Gulf states.

Brunei Darussalam, Malaysia, Singapore, and Indonesia started the adoption of the New MABIMS Crescent Visibility Criteria back in 2024 to better unify their holidays arrangements. I think we can probably use data from https://accuhijri.github.io/ as a separate islamic_mabims calendar.

Edit: additional info here https://www.muslim.sg/articles/ramadan-countdown-unity-in-diversity

Brunei Darussalam, Malaysia, and Indonesia have used the New MABIMS Crescent Visibility Criteria since 2021 as a reference for tentative date announcements, while the actual dates are still determined by "Ru'yah" (observation). In contrast, due to Singapore's weather conditions, the country has relied exclusively on "Hisāb" (astronomical calculations) since 1974, with Islamic dates observed strictly based on these calculations.

For practical reasons, the new _IslamicMabimsLunar calendar will primarily follow Singapore’s method of observance. Future dates will be calculated using AccuHijri, supplemented with historical data before 2025 whenever possible.

Image Image

excerpted from Navigating Tradition and Science: SINGAPORE’S APPROACH IN DETERMINING THE HIJRI CALENDAR

Although the Philippines is not a member of MABIMS, the country could still benefit from the new _IslamicMabimsLunar calculation as well as it's closer to their actual observance than Saudi Arabia's Umm al-Qura in the default _IslamicLunar

Country Holidays Affected:

  • Brunei Darussalam
  • Indonesia
  • Malaysia
  • (the) Philippines
  • Singapore

PPsyrius avatar Mar 07 '25 04:03 PPsyrius

Can I work on this? Please assign

AliCoder8 avatar Apr 10 '26 18:04 AliCoder8

Can I work on this? Please assign

Sure

PPsyrius avatar Apr 11 '26 01:04 PPsyrius

@PPsyrius Can I use ephem python library (It's good for performing high-precision astronomy computations) https://pypi.org/project/ephem/, instead of AccuHijri, https://accuhijri.github.io/

AliCoder8 avatar Apr 15 '26 06:04 AliCoder8

Why do you want to use a general-purpose astronomical library instead of a specialized one, which is focused on the needed tasks?

KJhellico avatar Apr 15 '26 20:04 KJhellico

I understand using AccuHijri is simpler because all you have to do is to input year and month. But it depends on other libraries e.g., numpy, which can break over time. In contrast, ephem has zero dependencies. I think it's more mature and stable. All you have to do is to calculate how high is the moon at sunset.

AliCoder8 avatar Apr 15 '26 21:04 AliCoder8

Here: https://github.com/accuhijri/ahc/blob/main/requirements.txt AccuHijri uses skyfield=1.45, using any other version will cause the library to break.

AliCoder8 avatar Apr 15 '26 21:04 AliCoder8

So, you want to implement the calculation yourself? Okay, you can go that way. But from https://rhodesmill.org/pyephem/ :

The Skyfield astronomy library should be preferred over PyEphem for new projects. Its modern design encourages better Python code, and uses NumPy to accelerate its calculations.

KJhellico avatar Apr 15 '26 22:04 KJhellico

My work so far:

  • Created the class _IslamicMabimsLunar ( uses astronomical calculations instead of a fixed tabular calendar for sighting of new moon.)
  • Add ephem to the dependencies.
  • Implemented it for Singapore, Malaysia and Brunei.

AliCoder8 avatar Apr 17 '26 21:04 AliCoder8

Hello @PPsyrius I submitted a PR to fix this issue one week ago. Why didn't it pass the review yet. https://github.com/vacanza/holidays/pull/3542

AliCoder8 avatar Apr 26 '26 02:04 AliCoder8

can i work on this ?

akshiDhi avatar May 28 '26 15:05 akshiDhi

@akshiDhi, sure, why not.

KJhellico avatar May 29 '26 12:05 KJhellico