-
-
Notifications
You must be signed in to change notification settings - Fork 554
Update Islamic holidays calculation #2981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…f entity calendar dates relative to Umm al-Qura dates
Summary by CodeRabbit
WalkthroughAdds a per-country Islamic calendar day offset (calendar_delta_days) to the lunar calendar and IslamicHolidays, applies a +1-day offset for multiple countries, and updates many country-specific Islamic holiday datasets and snapshots to reflect the shifted/confirmed dates. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2981 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 305 305
Lines 17998 18003 +5
Branches 2323 2323
=========================================
+ Hits 17998 18003 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (24)
holidays/calendars/islamic.py
(1 hunks)holidays/countries/guyana.py
(2 hunks)holidays/countries/india.py
(3 hunks)holidays/countries/iran.py
(2 hunks)holidays/countries/mauritius.py
(3 hunks)holidays/countries/myanmar.py
(3 hunks)holidays/countries/nepal.py
(3 hunks)holidays/countries/nigeria.py
(2 hunks)holidays/countries/sri_lanka.py
(2 hunks)holidays/countries/tanzania.py
(4 hunks)holidays/groups/islamic.py
(1 hunks)snapshots/countries/GY_COMMON.json
(30 hunks)snapshots/countries/IN_AN.json
(17 hunks)snapshots/countries/IN_AP.json
(23 hunks)snapshots/countries/IN_AR.json
(12 hunks)snapshots/countries/IN_AS.json
(17 hunks)snapshots/countries/IN_BR.json
(33 hunks)snapshots/countries/IN_CG.json
(21 hunks)snapshots/countries/IN_CH.json
(17 hunks)snapshots/countries/IN_COMMON.json
(12 hunks)snapshots/countries/IN_DH.json
(12 hunks)snapshots/countries/IN_DL.json
(12 hunks)snapshots/countries/IN_GA.json
(29 hunks)snapshots/countries/IN_GJ.json
(21 hunks)
🧰 Additional context used
🧠 Learnings (17)
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#2614
File: holidays/countries/guyana.py:78-90
Timestamp: 2025-06-13T12:18:03.539Z
Learning: The holidays codebase now uses the constructor signature pattern `__init__(self, *args, islamic_show_estimated: bool = True, **kwargs)` across country classes.
Applied to files:
holidays/groups/islamic.py
holidays/countries/iran.py
holidays/countries/nepal.py
holidays/countries/sri_lanka.py
holidays/calendars/islamic.py
holidays/countries/india.py
📚 Learning: 2025-07-10T15:55:34.523Z
Learnt from: KJhellico
PR: vacanza/holidays#2706
File: holidays/countries/cayman_islands.py:50-55
Timestamp: 2025-07-10T15:55:34.523Z
Learning: The `islamic_show_estimated` parameter in country class constructors is only needed for countries that implement Islamic holidays (inherit from IslamicHolidays or _CustomIslamicHolidays groups). Countries with only Christian and secular holidays do not need this parameter.
Applied to files:
holidays/groups/islamic.py
holidays/countries/myanmar.py
holidays/countries/iran.py
holidays/countries/nigeria.py
holidays/countries/mauritius.py
holidays/countries/nepal.py
holidays/countries/sri_lanka.py
holidays/countries/guyana.py
holidays/countries/tanzania.py
holidays/countries/india.py
📚 Learning: 2025-04-03T05:59:57.480Z
Learnt from: PPsyrius
PR: vacanza/holidays#2407
File: snapshots/countries/TL_COMMON.json:7-7
Timestamp: 2025-04-03T05:59:57.480Z
Learning: In the holidays project, snapshot files (like snapshots/countries/TL_COMMON.json) are auto-generated when running `make snapshot` and should not be manually edited. Semicolons (;) in holiday entries are used as separators when multiple holidays occur on the same date.
Applied to files:
snapshots/countries/GY_COMMON.json
snapshots/countries/IN_COMMON.json
snapshots/countries/IN_BR.json
📚 Learning: 2025-03-19T16:54:58.657Z
Learnt from: PPsyrius
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.
Applied to files:
snapshots/countries/GY_COMMON.json
snapshots/countries/IN_AR.json
snapshots/countries/IN_AP.json
snapshots/countries/IN_COMMON.json
snapshots/countries/IN_AN.json
snapshots/countries/IN_GA.json
snapshots/countries/IN_DH.json
snapshots/countries/IN_CH.json
snapshots/countries/IN_AS.json
snapshots/countries/IN_DL.json
holidays/countries/guyana.py
snapshots/countries/IN_BR.json
📚 Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
PR: vacanza/holidays#2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.
Applied to files:
holidays/countries/myanmar.py
holidays/countries/mauritius.py
holidays/countries/nepal.py
holidays/countries/india.py
📚 Learning: 2025-09-18T00:32:25.031Z
Learnt from: PPsyrius
PR: vacanza/holidays#2944
File: tests/countries/test_myanmar.py:32-39
Timestamp: 2025-09-18T00:32:25.031Z
Learning: Myanmar holidays implementation uses StaticHolidays with special_public_holidays for government-declared substitutions/bridging days, not ObservedHolidayBase for weekend-to-weekday shifting. Myanmar's substituted holidays are always present and don't have observed=False functionality.
Applied to files:
holidays/countries/myanmar.py
📚 Learning: 2025-08-22T19:06:04.303Z
Learnt from: KJhellico
PR: vacanza/holidays#2850
File: holidays/countries/christmas_island.py:75-80
Timestamp: 2025-08-22T19:06:04.303Z
Learning: Christmas Island's docstring for the `islamic_show_estimated` parameter follows the exact same format used consistently across all countries with Islamic holidays in the codebase: "Whether to add 'estimated' label to Islamic holidays name if holiday date is estimated." This is the standard, established pattern and should not be changed.
Applied to files:
holidays/countries/myanmar.py
holidays/countries/nigeria.py
holidays/countries/mauritius.py
holidays/countries/sri_lanka.py
holidays/countries/tanzania.py
📚 Learning: 2025-04-13T19:10:31.502Z
Learnt from: KJhellico
PR: vacanza/holidays#2465
File: holidays/countries/suriname.py:219-251
Timestamp: 2025-04-13T19:10:31.502Z
Learning: The `_CustomIslamicHolidays` classes in this project contain only exact verified holiday dates from reliable sources, rather than calculated or estimated future dates. This is by design to ensure accuracy, particularly for religious holidays that may follow lunar calendars or depend on local observations.
Applied to files:
holidays/countries/myanmar.py
holidays/countries/nepal.py
holidays/countries/sri_lanka.py
holidays/countries/india.py
📚 Learning: 2025-09-17T15:15:24.269Z
Learnt from: KJhellico
PR: vacanza/holidays#2944
File: holidays/countries/myanmar.py:112-121
Timestamp: 2025-09-17T15:15:24.269Z
Learning: The Myanmar government's "continuous public days for 2024-2025" policy specifically covers Tabaung and Tazaungmon full moon days by bridging gaps with weekends, but does not apply to Myanmar New Year (Thingyan) extra days, which follow a separate policy that correctly uses `self._year >= 2024`.
Applied to files:
holidays/countries/myanmar.py
📚 Learning: 2025-08-21T06:52:25.511Z
Learnt from: PPsyrius
PR: vacanza/holidays#2843
File: holidays/countries/burundi.py:140-155
Timestamp: 2025-08-21T06:52:25.511Z
Learning: In the holidays library Islamic calendar implementation, CONFIRMED_YEARS represents the full range of years that have been officially verified, while the individual EID_AL_FITR_DATES and EID_AL_ADHA_DATES dictionaries only contain entries for years where the official dates differ from the base Umm al-Qura algorithmic calculations. Years within CONFIRMED_YEARS but not in the explicit date dictionaries will use the base algorithm but be marked as "confirmed" rather than "estimated".
Applied to files:
holidays/countries/myanmar.py
holidays/countries/nigeria.py
holidays/countries/mauritius.py
holidays/countries/nepal.py
holidays/countries/sri_lanka.py
holidays/countries/guyana.py
holidays/countries/tanzania.py
holidays/countries/india.py
📚 Learning: 2025-06-19T02:34:14.456Z
Learnt from: PPsyrius
PR: vacanza/holidays#2643
File: holidays/countries/mauritius.py:171-184
Timestamp: 2025-06-19T02:34:14.456Z
Learning: In the holidays library, `_CustomIslamicHolidays` subclasses follow a consistent pattern of NOT having docstrings. They go directly to defining date dictionaries, as evidenced by Malaysia, Singapore, UAE, and dozens of other country implementations.
Applied to files:
holidays/countries/myanmar.py
holidays/countries/sri_lanka.py
holidays/countries/india.py
📚 Learning: 2025-09-14T16:05:55.205Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_iran.py:28-28
Timestamp: 2025-09-14T16:05:55.205Z
Learning: In tests/countries/test_iran.py, using years=(self.start_year - 1, 2102) in the no-holiday test is intentional because Iran uses the Persian Calendar which has specific supported year range constraints, and 2102 represents the upper limit of the Persian Calendar's supported range, not just an arbitrary far-future date.
Applied to files:
holidays/countries/iran.py
📚 Learning: 2025-06-04T10:09:28.732Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2593
File: holidays/calendars/islamic.py:3993-3994
Timestamp: 2025-06-04T10:09:28.732Z
Learning: In the holidays/calendars/islamic.py file, the Islamic calendar date methods in the _IslamicLunar class (like ali_al_rida_death_dates, ashura_dates, etc.) follow a consistent pattern of being single-line methods that return self._get_holiday(CONSTANT, year) without docstrings. New methods should follow this same pattern for consistency.
Applied to files:
holidays/countries/iran.py
holidays/calendars/islamic.py
📚 Learning: 2025-08-26T09:43:38.329Z
Learnt from: PPsyrius
PR: vacanza/holidays#2821
File: holidays/countries/tanzania.py:145-163
Timestamp: 2025-08-26T09:43:38.329Z
Learning: In the Tanzania holidays implementation, when multiple holidays fall on the same date (like Eid al-Fitr and Mwalimu Nyerere Day on 2007-10-14), the observed rule logic correctly applies to all holidays on that date. The SAT_SUN_TO_NEXT_MON_TUE rule for the first Eid day doesn't create issues with co-occurring holidays because in practice, such collisions occur on Sundays where both SAT_SUN_TO_NEXT_MON and SAT_SUN_TO_NEXT_MON_TUE rules yield identical results (both move to Monday).
Applied to files:
holidays/countries/tanzania.py
📚 Learning: 2025-06-14T20:12:37.212Z
Learnt from: KJhellico
PR: vacanza/holidays#2614
File: holidays/countries/guyana.py:146-179
Timestamp: 2025-06-14T20:12:37.212Z
Learning: The `_CustomHinduHolidays` mechanism works through `_CustomCalendarType` metaclass which renames public attributes (like `DIWALI_INDIA_DATES`) with a postfix, allowing `_HinduLunisolar::_get_holiday` to find and use custom holiday dates. When `_add_diwali_india()` is called, it uses the custom dates if available rather than calculated dates.
Applied to files:
holidays/countries/india.py
📚 Learning: 2025-05-06T13:01:22.693Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2522
File: holidays/countries/yemen.py:158-163
Timestamp: 2025-05-06T13:01:22.693Z
Learning: In the holidays library, the RAMADAN_BEGINNING_DATES dictionary in country-specific Islamic holiday classes (like YemenIslamicHolidays) is used indirectly through the backend. When a country class calls _add_holiday_29_ramadan(), the IslamicHolidays implementation uses the country's custom calendar dates to calculate the 29th day of Ramadan by adding 28 days to the beginning date.
Applied to files:
holidays/countries/india.py
📚 Learning: 2025-08-26T21:29:47.753Z
Learnt from: KJhellico
PR: vacanza/holidays#2860
File: tests/common.py:365-372
Timestamp: 2025-08-26T21:29:47.753Z
Learning: In the holidays library, countries with Islamic holidays inherit directly from the IslamicHolidays class (e.g., `class Afghanistan(HolidayBase, InternationalHolidays, IslamicHolidays)`). The separate `_CustomIslamicHolidays` classes (like `AfghanistanIslamicHolidays`) are helper classes for specific date data, not the main country classes. Therefore, `isinstance(holidays_instance, IslamicHolidays)` is sufficient to detect all countries with Islamic holidays.
Applied to files:
holidays/countries/india.py
🧬 Code graph analysis (9)
holidays/groups/islamic.py (1)
holidays/calendars/islamic.py (1)
_IslamicLunar
(61-4095)
holidays/countries/myanmar.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/iran.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/mauritius.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/nepal.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/sri_lanka.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/calendars/islamic.py (3)
holidays/calendars/custom.py (1)
_CustomCalendar
(33-34)holidays/helpers.py (1)
_normalize_tuple
(39-49)holidays/calendars/gregorian.py (1)
_timedelta
(37-42)
holidays/countries/guyana.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/india.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test Python 3.13 on windows-latest
🔇 Additional comments (16)
holidays/countries/nigeria.py (3)
68-70
: Helpful country-specific shift note. LGTM.
74-78
: calendar_shift=+1 correctly propagated to IslamicHolidays.
This aligns Nigeria with observed +1 offsets.
152-235
: Confirm confirmed-years vs explicit overrides to preserve intended +1 shift.
Reminder: shift is applied only to estimated dates. Years within CONFIRMED_YEARS will not shift unless explicitly listed in the date dicts. Please verify:
- CONFIRMED_YEARS ranges truly reflect official confirmations for all those years.
- EID_AL_ADHA_DATES, EID_AL_FITR_DATES, MAWLID_DATES contain only years that differ from base (not duplicates), per project convention.
If some confirmed years should be +1 vs base, add them to the dicts so the offset is realized even though they’re confirmed. Based on learnings
holidays/groups/islamic.py (1)
28-33
: calendar_shift propagation looks correct.
Backwards-compatible default; matches _IslamicLunar usage.holidays/countries/myanmar.py (4)
64-66
: Country-specific shift note: clear and useful.
72-76
: calendar_shift=+1 wiring is correct.
Matches intended nationwide +1 behavior for estimated dates.
16-16
: Import minimization looks good.
Only months used by this module are imported. Based on learnings
169-171
: Verify Myanmar EID al-Adha date adjustments for 2020–2025. With EID_AL_ADHA_DATES_CONFIRMED_YEARS=(2020, 2025) and no explicit EID_AL_ADHA_DATES overrides, those years default to the base (unshifted) algorithm. If Myanmar’s official dates are shifted by +1 day, add explicit entries to EID_AL_ADHA_DATES; otherwise, this configuration is correct.holidays/countries/sri_lanka.py (3)
98-100
: Country-specific shift note: concise and appropriate.
105-109
: calendar_shift=+1 correctly wired into IslamicHolidays.
296-324
: Confirm intent: confirmed range + trimmed dicts vs shift behavior.
With EID_AL_ADHA/FITR/MAWLID CONFIRMED_YEARS=(2003, 2025) and end_year=2025, non-listed years within 2003–2025 won’t shift (they use base dates, marked confirmed). Please verify that base dates match official Sri Lanka observances for those years; if they’re typically +1 vs base, add explicit overrides to keep accuracy while retaining “confirmed” labeling. Based on learningssnapshots/countries/IN_DL.json (1)
2-15
: Snapshot realignment looks consistent with +1 Islamic shift.
No structural changes observed; data-only updates.snapshots/countries/IN_CH.json (1)
1415-1424
: Here's a shell script to verify that holiday labels in IN_CH.json follow the estimated/confirmed pattern:#!/bin/bash file="snapshots/countries/IN_CH.json" echo "Entries outside 2001–2025 missing '(estimated)':" jq -r 'to_entries[] | select(.key < "2001-01-01" or .key > "2025-12-31") | select(.value | test("estimated") | not) | "\(.key) -> \(.value)"' "$file" echo "Entries in 2001–2025 wrongly marked '(estimated)':" jq -r 'to_entries[] | select(.key >= "2001-01-01" and .key <= "2025-12-31") | select(.value | test("estimated")) | "\(.key) -> \(.value)"' "$file"Run this and share any output to confirm label discipline.
snapshots/countries/IN_GJ.json (1)
1489-1499
: Gujarat snapshot matches the shift and regional merges; sanity-check via script.“Gujarat Day; Labor Day” combos and Islamic shifts look consistent. Please run the shared script to validate “(estimated)” labeling windows and 2024 anchors across all IN_* snapshots.
Also applies to: 1603-1612
snapshots/countries/IN_DH.json (1)
1348-1356
: Verify “(estimated)” labeling and 2024 anchor entries
Shift matches calendar_shift (+1) and future Islamic holidays include “(estimated)”. Confirm in each country snapshot that:
- No “(estimated)” appears on Islamic entries dated 2001–2025
- 2024-04-11 (Eid al-Fitr), 2024-06-17 (Eid al-Adha), 2024-07-17 (Ashura), and 2024-09-16 (Prophet’s Birthday) are present.
snapshots/countries/IN_AS.json (1)
1422-1433
: Invariant checks passed: no missing 2024 anchors across IN_ snapshots.*
Assam’s 2026 entries (including estimated labels) align correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome implementation!
Let's take care of naming and it's good to go 👍
d1acff2
to
c092eab
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
holidays/countries/india.py (1)
13-18
: Annotate class-level date dicts/tuples with ClassVar to satisfy Ruff (RUF012)Ruff flags mutable class attributes. Import ClassVar and annotate.
Apply:
import warnings from gettext import gettext as tr +from typing import ClassVar @@ class IndiaIslamicHolidays(_CustomIslamicHolidays): - ASHURA_DATES_CONFIRMED_YEARS = (2001, 2025) - ASHURA_DATES = { + ASHURA_DATES_CONFIRMED_YEARS: ClassVar[tuple[int, int]] = (2001, 2025) + ASHURA_DATES: ClassVar[dict[int, tuple]] = { ... - EID_AL_ADHA_DATES_CONFIRMED_YEARS = (2001, 2025) - EID_AL_ADHA_DATES = { + EID_AL_ADHA_DATES_CONFIRMED_YEARS: ClassVar[tuple[int, int]] = (2001, 2025) + EID_AL_ADHA_DATES: ClassVar[dict[int, tuple]] = { ... - EID_AL_FITR_DATES_CONFIRMED_YEARS = (2001, 2025) - EID_AL_FITR_DATES = { + EID_AL_FITR_DATES_CONFIRMED_YEARS: ClassVar[tuple[int, int]] = (2001, 2025) + EID_AL_FITR_DATES: ClassVar[dict[int, tuple]] = { ... - MAWLID_DATES_CONFIRMED_YEARS = (2001, 2025) - MAWLID_DATES = { + MAWLID_DATES_CONFIRMED_YEARS: ClassVar[tuple[int, int]] = (2001, 2025) + MAWLID_DATES: ClassVar[dict[int, tuple]] = { ...Repeat for any additional class date constants if present. [Based on learnings]
Also applies to: 525-563
holidays/countries/iran.py (1)
13-20
: Add ClassVar annotations to appease Ruff (RUF012)Import ClassVar and annotate class-level dict/tuple attributes in IranIslamicHolidays.
Apply (pattern):
from gettext import gettext as tr +from typing import ClassVar @@ class IranIslamicHolidays(_CustomIslamicHolidays): - ALI_AL_RIDA_DEATH_DATES_CONFIRMED_YEARS = (2001, 2025) - ALI_AL_RIDA_DEATH_DATES = { + ALI_AL_RIDA_DEATH_DATES_CONFIRMED_YEARS: ClassVar[tuple[int, int]] = (2001, 2025) + ALI_AL_RIDA_DEATH_DATES: ClassVar[dict[int, tuple]] = { ... - ALI_BIRTHDAY_DATES_CONFIRMED_YEARS = (2001, 2025) - ALI_BIRTHDAY_DATES = { + ALI_BIRTHDAY_DATES_CONFIRMED_YEARS: ClassVar[tuple[int, int]] = (2001, 2025) + ALI_BIRTHDAY_DATES: ClassVar[dict[int, tuple]] = { ...Repeat this annotation for all remaining CONFIRMED_YEARS and DATES in the class. [Based on learnings]
Also applies to: 170-176
♻️ Duplicate comments (1)
holidays/groups/islamic.py (1)
28-33
: Add a brief init docstring for calendar_delta_days.Document cls, show_estimated, and calendar_delta_days (int day offset applied by the underlying Islamic calendar). Improves discoverability without changing behavior.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (11)
holidays/calendars/islamic.py
(1 hunks)holidays/countries/guyana.py
(2 hunks)holidays/countries/india.py
(3 hunks)holidays/countries/iran.py
(2 hunks)holidays/countries/mauritius.py
(3 hunks)holidays/countries/myanmar.py
(3 hunks)holidays/countries/nepal.py
(3 hunks)holidays/countries/nigeria.py
(2 hunks)holidays/countries/sri_lanka.py
(2 hunks)holidays/countries/tanzania.py
(4 hunks)holidays/groups/islamic.py
(1 hunks)
🧰 Additional context used
🧠 Learnings (19)
📓 Common learnings
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2522
File: holidays/countries/yemen.py:158-163
Timestamp: 2025-05-06T13:01:22.693Z
Learning: In the holidays library, the RAMADAN_BEGINNING_DATES dictionary in country-specific Islamic holiday classes (like YemenIslamicHolidays) is used indirectly through the backend. When a country class calls _add_holiday_29_ramadan(), the IslamicHolidays implementation uses the country's custom calendar dates to calculate the 29th day of Ramadan by adding 28 days to the beginning date.
Learnt from: KJhellico
PR: vacanza/holidays#2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:00:47.849Z
Learning: In the holidays library, Islamic holidays use dedicated methods for additional days (like `_add_eid_al_fitr_day_two`, `_add_eid_al_adha_day_two`) rather than parameters. The methods don't accept a `days` parameter - each day has its own specific method.
📚 Learning: 2025-07-10T15:55:34.523Z
Learnt from: KJhellico
PR: vacanza/holidays#2706
File: holidays/countries/cayman_islands.py:50-55
Timestamp: 2025-07-10T15:55:34.523Z
Learning: The `islamic_show_estimated` parameter in country class constructors is only needed for countries that implement Islamic holidays (inherit from IslamicHolidays or _CustomIslamicHolidays groups). Countries with only Christian and secular holidays do not need this parameter.
Applied to files:
holidays/countries/guyana.py
holidays/countries/tanzania.py
holidays/countries/sri_lanka.py
holidays/groups/islamic.py
holidays/countries/myanmar.py
holidays/countries/nepal.py
holidays/countries/iran.py
holidays/countries/mauritius.py
holidays/countries/nigeria.py
holidays/countries/india.py
📚 Learning: 2025-08-22T19:06:04.303Z
Learnt from: KJhellico
PR: vacanza/holidays#2850
File: holidays/countries/christmas_island.py:75-80
Timestamp: 2025-08-22T19:06:04.303Z
Learning: Christmas Island's docstring for the `islamic_show_estimated` parameter follows the exact same format used consistently across all countries with Islamic holidays in the codebase: "Whether to add 'estimated' label to Islamic holidays name if holiday date is estimated." This is the standard, established pattern and should not be changed.
Applied to files:
holidays/countries/guyana.py
holidays/countries/tanzania.py
holidays/countries/sri_lanka.py
holidays/groups/islamic.py
holidays/countries/myanmar.py
holidays/countries/nepal.py
holidays/countries/mauritius.py
holidays/countries/nigeria.py
holidays/countries/india.py
📚 Learning: 2025-06-13T12:18:03.539Z
Learnt from: PPsyrius
PR: vacanza/holidays#2614
File: holidays/countries/guyana.py:78-90
Timestamp: 2025-06-13T12:18:03.539Z
Learning: The holidays codebase now uses the constructor signature pattern `__init__(self, *args, islamic_show_estimated: bool = True, **kwargs)` across country classes.
Applied to files:
holidays/countries/guyana.py
holidays/countries/sri_lanka.py
holidays/groups/islamic.py
holidays/calendars/islamic.py
holidays/countries/myanmar.py
holidays/countries/nepal.py
holidays/countries/iran.py
holidays/countries/mauritius.py
holidays/countries/india.py
📚 Learning: 2025-03-19T16:54:58.657Z
Learnt from: PPsyrius
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:146-159
Timestamp: 2025-03-19T16:54:58.657Z
Learning: In the holidays library implementation, explicit holiday dates (like Diwali in Fiji) are only defined for historical years with official sources (2016-2025). Future dates beyond the explicitly defined range are automatically calculated by methods like `_add_diwali`, which provide approximations when official dates aren't yet available.
Applied to files:
holidays/countries/guyana.py
📚 Learning: 2025-08-26T09:43:38.329Z
Learnt from: PPsyrius
PR: vacanza/holidays#2821
File: holidays/countries/tanzania.py:145-163
Timestamp: 2025-08-26T09:43:38.329Z
Learning: In the Tanzania holidays implementation, when multiple holidays fall on the same date (like Eid al-Fitr and Mwalimu Nyerere Day on 2007-10-14), the observed rule logic correctly applies to all holidays on that date. The SAT_SUN_TO_NEXT_MON_TUE rule for the first Eid day doesn't create issues with co-occurring holidays because in practice, such collisions occur on Sundays where both SAT_SUN_TO_NEXT_MON and SAT_SUN_TO_NEXT_MON_TUE rules yield identical results (both move to Monday).
Applied to files:
holidays/countries/tanzania.py
📚 Learning: 2025-10-03T17:46:23.800Z
Learnt from: KJhellico
PR: vacanza/holidays#2981
File: holidays/calendars/islamic.py:3987-4003
Timestamp: 2025-10-03T17:46:23.800Z
Learning: In the holidays library Islamic calendar implementation with calendar_shift feature, CONFIRMED_YEARS represents years where the base Umm al-Qura calculation plus the calendar_shift has been verified as correct, while confirmed_dates contains explicit dates that should not be shifted. Years within CONFIRMED_YEARS but not in the explicit date dictionaries will use the base Umm al-Qura algorithm with the calendar_shift applied and be marked as "confirmed" rather than "estimated".
Applied to files:
holidays/countries/tanzania.py
holidays/calendars/islamic.py
📚 Learning: 2025-04-13T19:10:31.502Z
Learnt from: KJhellico
PR: vacanza/holidays#2465
File: holidays/countries/suriname.py:219-251
Timestamp: 2025-04-13T19:10:31.502Z
Learning: The `_CustomIslamicHolidays` classes in this project contain only exact verified holiday dates from reliable sources, rather than calculated or estimated future dates. This is by design to ensure accuracy, particularly for religious holidays that may follow lunar calendars or depend on local observations.
Applied to files:
holidays/countries/sri_lanka.py
holidays/countries/myanmar.py
holidays/countries/nepal.py
holidays/countries/india.py
📚 Learning: 2025-06-19T02:34:14.456Z
Learnt from: PPsyrius
PR: vacanza/holidays#2643
File: holidays/countries/mauritius.py:171-184
Timestamp: 2025-06-19T02:34:14.456Z
Learning: In the holidays library, `_CustomIslamicHolidays` subclasses follow a consistent pattern of NOT having docstrings. They go directly to defining date dictionaries, as evidenced by Malaysia, Singapore, UAE, and dozens of other country implementations.
Applied to files:
holidays/countries/sri_lanka.py
holidays/countries/myanmar.py
holidays/countries/india.py
📚 Learning: 2025-08-19T21:00:47.849Z
Learnt from: KJhellico
PR: vacanza/holidays#2831
File: holidays/countries/south_sudan.py:84-88
Timestamp: 2025-08-19T21:00:47.849Z
Learning: In the holidays library, Islamic holidays use dedicated methods for additional days (like `_add_eid_al_fitr_day_two`, `_add_eid_al_adha_day_two`) rather than parameters. The methods don't accept a `days` parameter - each day has its own specific method.
Applied to files:
holidays/groups/islamic.py
📚 Learning: 2025-06-04T10:09:28.732Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2593
File: holidays/calendars/islamic.py:3993-3994
Timestamp: 2025-06-04T10:09:28.732Z
Learning: In the holidays/calendars/islamic.py file, the Islamic calendar date methods in the _IslamicLunar class (like ali_al_rida_death_dates, ashura_dates, etc.) follow a consistent pattern of being single-line methods that return self._get_holiday(CONSTANT, year) without docstrings. New methods should follow this same pattern for consistency.
Applied to files:
holidays/groups/islamic.py
holidays/calendars/islamic.py
holidays/countries/iran.py
📚 Learning: 2025-08-21T05:56:33.276Z
Learnt from: PPsyrius
PR: vacanza/holidays#2843
File: holidays/countries/burundi.py:15-16
Timestamp: 2025-08-21T05:56:33.276Z
Learning: In the holidays library, when importing Gregorian month constants from holidays.calendars.gregorian, only import the months that are actually used in the date data. For example, if Islamic holiday dates only reference JUN, JUL, SEP, OCT, then only import those specific constants rather than importing additional unused months.
Applied to files:
holidays/countries/myanmar.py
holidays/countries/nepal.py
holidays/countries/mauritius.py
holidays/countries/india.py
📚 Learning: 2025-09-18T00:32:25.031Z
Learnt from: PPsyrius
PR: vacanza/holidays#2944
File: tests/countries/test_myanmar.py:32-39
Timestamp: 2025-09-18T00:32:25.031Z
Learning: Myanmar holidays implementation uses StaticHolidays with special_public_holidays for government-declared substitutions/bridging days, not ObservedHolidayBase for weekend-to-weekday shifting. Myanmar's substituted holidays are always present and don't have observed=False functionality.
Applied to files:
holidays/countries/myanmar.py
📚 Learning: 2025-09-17T15:15:24.269Z
Learnt from: KJhellico
PR: vacanza/holidays#2944
File: holidays/countries/myanmar.py:112-121
Timestamp: 2025-09-17T15:15:24.269Z
Learning: The Myanmar government's "continuous public days for 2024-2025" policy specifically covers Tabaung and Tazaungmon full moon days by bridging gaps with weekends, but does not apply to Myanmar New Year (Thingyan) extra days, which follow a separate policy that correctly uses `self._year >= 2024`.
Applied to files:
holidays/countries/myanmar.py
📚 Learning: 2025-09-14T16:05:55.205Z
Learnt from: PPsyrius
PR: vacanza/holidays#2881
File: tests/countries/test_iran.py:28-28
Timestamp: 2025-09-14T16:05:55.205Z
Learning: In tests/countries/test_iran.py, using years=(self.start_year - 1, 2102) in the no-holiday test is intentional because Iran uses the Persian Calendar which has specific supported year range constraints, and 2102 represents the upper limit of the Persian Calendar's supported range, not just an arbitrary far-future date.
Applied to files:
holidays/countries/iran.py
📚 Learning: 2025-08-25T04:28:02.061Z
Learnt from: PPsyrius
PR: vacanza/holidays#2848
File: tests/countries/test_somalia.py:44-127
Timestamp: 2025-08-25T04:28:02.061Z
Learning: In the holidays library, Islamic holiday tests use `self.no_estimated_holidays = Country(years=years, islamic_show_estimated=False)` as the library-wide standard approach to simplify test cases. This pattern is intentional and preferred over testing estimated labels.
Applied to files:
holidays/countries/nigeria.py
📚 Learning: 2025-06-14T20:12:37.212Z
Learnt from: KJhellico
PR: vacanza/holidays#2614
File: holidays/countries/guyana.py:146-179
Timestamp: 2025-06-14T20:12:37.212Z
Learning: The `_CustomHinduHolidays` mechanism works through `_CustomCalendarType` metaclass which renames public attributes (like `DIWALI_INDIA_DATES`) with a postfix, allowing `_HinduLunisolar::_get_holiday` to find and use custom holiday dates. When `_add_diwali_india()` is called, it uses the custom dates if available rather than calculated dates.
Applied to files:
holidays/countries/india.py
📚 Learning: 2025-05-06T13:01:22.693Z
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2522
File: holidays/countries/yemen.py:158-163
Timestamp: 2025-05-06T13:01:22.693Z
Learning: In the holidays library, the RAMADAN_BEGINNING_DATES dictionary in country-specific Islamic holiday classes (like YemenIslamicHolidays) is used indirectly through the backend. When a country class calls _add_holiday_29_ramadan(), the IslamicHolidays implementation uses the country's custom calendar dates to calculate the 29th day of Ramadan by adding 28 days to the beginning date.
Applied to files:
holidays/countries/india.py
📚 Learning: 2025-08-26T21:29:47.753Z
Learnt from: KJhellico
PR: vacanza/holidays#2860
File: tests/common.py:365-372
Timestamp: 2025-08-26T21:29:47.753Z
Learning: In the holidays library, countries with Islamic holidays inherit directly from the IslamicHolidays class (e.g., `class Afghanistan(HolidayBase, InternationalHolidays, IslamicHolidays)`). The separate `_CustomIslamicHolidays` classes (like `AfghanistanIslamicHolidays`) are helper classes for specific date data, not the main country classes. Therefore, `isinstance(holidays_instance, IslamicHolidays)` is sufficient to detect all countries with Islamic holidays.
Applied to files:
holidays/countries/india.py
🧬 Code graph analysis (10)
holidays/countries/guyana.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/tanzania.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/sri_lanka.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/calendars/islamic.py (2)
holidays/helpers.py (1)
_normalize_tuple
(39-49)holidays/calendars/gregorian.py (1)
_timedelta
(37-42)
holidays/countries/myanmar.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/nepal.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/iran.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/mauritius.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/nigeria.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
holidays/countries/india.py (1)
holidays/groups/islamic.py (1)
IslamicHolidays
(20-452)
🪛 Ruff (0.13.3)
holidays/countries/sri_lanka.py
301-306: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
309-317: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
holidays/groups/islamic.py
28-28: Boolean default positional argument in function definition
(FBT002)
holidays/countries/iran.py
181-191: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
194-201: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
204-216: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
219-228: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
231-238: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
241-254: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
257-264: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
267-277: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
280-286: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
289-299: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
302-312: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
315-327: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
330-336: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
339-353: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
holidays/countries/nigeria.py
179-205: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
holidays/countries/india.py
537-544: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
547-553: Mutable class attributes should be annotated with typing.ClassVar
(RUF012)
⏰ Context from checks skipped due to timeout of 300000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Run pre-commit
🔇 Additional comments (14)
holidays/countries/mauritius.py (1)
16-16
: Mauritius: +1 delta and trimmed explicit dates align with new model.Imports narrowed appropriately; ctor note and calendar_delta_days=+1 are consistent; confirmed years + sparse explicit dates look good.
Also applies to: 69-71, 77-81, 176-179
holidays/countries/nigeria.py (1)
68-70
: Nigeria: delta propagation and confirmed ranges look consistent.Doc note, calendar_delta_days=+1, and updated explicit dates fit the new shift semantics. No blockers.
Also applies to: 74-78, 156-175, 179-205, 210-234
holidays/countries/nepal.py (1)
14-14
: Nepal: +1 delta and concise explicit datasets are appropriate.Import pruning is fine; ctor doc + calendar_delta_days=+1 and confirmed-year spans align with the new flow.
Also applies to: 62-64, 69-73, 383-385
holidays/countries/myanmar.py (1)
16-16
: Myanmar: shift and confirmed range integrated cleanly.Doc note + calendar_delta_days=+1 and confirmed-years tuple for Eid al-Adha fit the model.
Also applies to: 64-66, 72-76, 170-171
holidays/countries/sri_lanka.py (1)
98-100
: Sri Lanka: +1 delta and explicit datasets look good.Ctor note and delta forwarding are correct; confirmed-year spans with sparse explicit dates align with base+delta confirmation.
Also applies to: 105-109, 301-306, 309-317, 321-324
holidays/countries/guyana.py (1)
86-88
: Guyana: +1 delta adoption and confirmed ranges are consistent.Doc, delta propagation, and explicit/confirmed datasets align with the shift mechanism.
Also applies to: 93-97, 219-228, 233-243
holidays/calendars/islamic.py (1)
3987-3994
: No changes required for CONFIRMED_YEARS naming. The metaclass appends_CUSTOM_CALENDAR
to each public attribute, so defining*_DATES_CONFIRMED_YEARS
without the suffix in country classes correctly yields*_DATES_CONFIRMED_YEARS_CUSTOM_CALENDAR
at runtime.holidays/countries/tanzania.py (2)
125-135
: Good: +1 Islamic calendar shift correctly wiredDoc note and calendar_delta_days=+1 passed to IslamicHolidays via TanzaniaIslamicHolidays look correct. Aligns with new shift mechanism. [Based on learnings]
333-338
: Datasets realigned; confirm sources match shiftUpdated Eid al-Adha, Eid al-Fitr, and Mawlid dates appear consistent with +1 shift and confirmed-years semantics. Please double‑check against your cited sources/snapshots. [Based on learnings]
Also applies to: 364-368, 394-398
holidays/countries/india.py (3)
160-162
: Good: documents and applies +1 Islamic calendar shiftThe doc note and calendar_delta_days=+1 wiring via IndiaIslamicHolidays are correct and consistent with the new API. [Based on learnings]
Also applies to: 166-170
525-563
: Data updates look consistent with shift; ensure provenanceASHURA, EID_AL_ADHA, EID_AL_FITR, MAWLID mappings trimmed/realigned. Looks fine. Please ensure the removed/added years match authoritative sources/snapshots.
17-17
: JUN/JUL aren’t used in holidays/countries/india.py, so importing them is unnecessary.Likely an incorrect or invalid review comment.
holidays/countries/iran.py (2)
61-63
: Good: documents and applies +1 Islamic calendar shiftDoc note and calendar_delta_days=+1 wiring via IranIslamicHolidays align with the new mechanism. [Based on learnings]
Also applies to: 65-69
173-178
: Bulk Islamic date realignment looks coherent; confirm against sourcesThe updated mappings across many observances match the +1 shift approach and confirmed-years semantics (confirmed years can rely on base+shift). Please reconfirm values vs sources/snapshots. [Based on learnings]
Also applies to: 182-191, 195-201, 205-216, 220-228, 232-238, 242-254, 258-264, 268-277, 281-286, 291-299, 303-312, 316-327, 331-336, 340-353, 357-365
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Proposed change
Looking at the dates of Islamic holidays, we can see that some countries have relatively stable difference from our base Islamic calendar (Umm al-Qura). So, it would be a good idea to add the option to specify the value of this difference and consider it during the calculation.
This PR inspired by #2885 and actually supersede it.
Type of change
holidays
functionality in general)Checklist
make check
locally; all checks and tests passed.