+
Skip to content

Conversation

KJhellico
Copy link
Collaborator

@KJhellico KJhellico commented Jul 26, 2025

Proposed change

Countries with Eastern holidays have lists of dates (mappings) in their custom calendars that only partially differ from the reference dates. I propose the concept of a "confirmed years range". If the year falls within this range (for a certain holiday), the date of this holiday will be considered "exact" regardless of its presence in mapping.

Azerbaijan has been updated as implementation example.

Type of change

  • New country/market holidays support (thank you!)
  • Supported country/market holidays update (calendar discrepancy fix, localization)
  • Existing code/documentation/test/process quality improvement (best practice, cleanup, refactoring, optimization)
  • Dependency update (version deprecation/pin/upgrade)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (a code change causing existing functionality to break)
  • New feature (new holidays functionality in general)

Checklist

Copy link
Contributor

coderabbitai bot commented Jul 26, 2025

Summary by CodeRabbit

  • New Features

    • Added confirmed year ranges for many Islamic and Chinese holidays across various countries, improving clarity on which years have verified holiday dates.
  • Bug Fixes

    • Updated certain holiday dates from estimated to confirmed for Niger in 2015.
  • Refactor

    • Reduced explicit year-to-date mappings for holidays, replacing them with confirmed year range indicators to streamline data.
  • Chores

    • Cleaned up and simplified import statements by removing unused constants in multiple country modules.

Walkthrough

This update refines the internal logic for determining the verification status of Islamic holiday dates by introducing a "checked range" attribute to distinguish confirmed from estimated dates. It also prunes explicit holiday date listings across many country-specific Islamic holiday classes, replacing them with tuples indicating confirmed year ranges to streamline data management and accuracy.

Changes

Cohort / File(s) Change Summary
Islamic calendar logic
holidays/calendars/islamic.py
Refined _get_holiday method in _IslamicLunar class to use "confirmed_dates" and "confirmed_years" attributes for improved date verification.
Chinese calendar logic
holidays/calendars/chinese.py
Modified _get_holiday method to incorporate confirmed dates and confirmed year ranges for holiday date validation.
Azerbaijan Islamic holidays data
holidays/countries/azerbaijan.py
Removed multiple explicit year entries from Eid holiday date dictionaries; added confirmed year range tuples for Eid al-Adha and Eid al-Fitr.
Afghanistan Islamic holidays data
holidays/countries/afghanistan.py
Removed intermediate year entries from multiple holiday date dictionaries; added confirmed year range tuples for several Islamic holidays.
Albania Islamic holidays data
holidays/countries/albania.py
Replaced detailed year-to-date dictionaries with confirmed year range tuples for Eid holidays; simplified imports.
Argentina Islamic holidays data
holidays/countries/argentina.py
Pruned intermediate years from Eid and Hijri New Year date dictionaries; added confirmed year range tuples.
Bahrain Islamic holidays data
holidays/countries/bahrain.py
Removed explicit holiday date dictionaries; introduced confirmed year range tuples for multiple Islamic holidays; simplified imports.
Bosnia and Herzegovina Islamic holidays data
holidays/countries/bosnia_and_herzegovina.py
Reduced explicit Eid holiday dates; added confirmed year range tuples; simplified imports.
Brunei Islamic holidays data
holidays/countries/brunei.py
Removed many historical holiday dates; added confirmed year range tuples for multiple Islamic holidays.
Burkina Faso Islamic holidays data
holidays/countries/burkina_faso.py
Removed several year entries from Eid and Mawlid dates; added confirmed year range tuples; adjusted imports.
Cameroon Islamic holidays data
holidays/countries/cameroon.py
Pruned many years from Eid and Mawlid date dictionaries; added confirmed year range tuples.
Central African Republic Islamic holidays data
holidays/countries/central_african_republic.py
Removed intermediate years from Eid date dictionaries; added confirmed year range tuples; simplified imports.
Chad Islamic holidays data
holidays/countries/chad.py
Removed several years from Eid and Mawlid date dictionaries; added confirmed year range tuples; simplified imports.
Christmas Island holidays data
holidays/countries/christmas_island.py
Added confirmed year range tuples for Lunar New Year and Eid holidays; removed some historical date entries; simplified imports.
Cocos Islands Islamic holidays data
holidays/countries/cocos_islands.py
Removed multiple year entries from Eid, Hijri New Year, and Mawlid dictionaries; added confirmed year range tuples; simplified imports.
Egypt Islamic holidays data
holidays/countries/egypt.py
Reduced holiday date dictionaries to fewer years; added confirmed year range tuples; simplified imports.
Ethiopia Islamic holidays data
holidays/countries/ethiopia.py
Truncated Eid and Mawlid date dictionaries to boundary years; added confirmed year range tuples; simplified imports.
Fiji Islamic holidays data
holidays/countries/fiji.py
Removed select Mawlid date entries; added confirmed year range tuple for Mawlid.
Gabon Islamic holidays data
holidays/countries/gabon.py
Removed multiple year entries from Eid date dictionaries; added confirmed year range tuples; simplified imports.
Guinea Islamic holidays data
holidays/countries/guinea.py
Removed multiple years from Eid, Mawlid, and Laylat al-Qadr date dictionaries; added confirmed year range tuples; simplified imports.
Guyana Islamic holidays data
holidays/countries/guyana.py
Removed multiple years from Eid and Mawlid date dictionaries; added confirmed year range tuples.
India Islamic holidays data
holidays/countries/india.py
Added alias classes IN and IND; pruned multiple year entries from Islamic holiday dictionaries; added confirmed year range tuples.
Indonesia holidays data
holidays/countries/indonesia.py
Pruned many historical years from Chinese and Islamic holiday date dictionaries; added confirmed year range tuples.
Iran Islamic holidays data
holidays/countries/iran.py
Removed many year entries from multiple Islamic holiday date dictionaries; added confirmed year range tuples for each holiday.
Kazakhstan Islamic holidays data
holidays/countries/kazakhstan.py
Removed multiple year entries from Eid al-Adha dates; added confirmed year range tuple; simplified imports.
Kenya Islamic holidays data
holidays/countries/kenya.py
Removed several years from Eid date dictionaries; added confirmed year range tuples.
Lebanon Islamic holidays data
holidays/countries/lebanon.py
Removed multiple year entries from various Islamic holiday date dictionaries; added confirmed year range tuples; simplified imports.
Libya Islamic holidays data
holidays/countries/libya.py
Removed multiple year entries from Eid, Hijri New Year, and Mawlid date dictionaries; added confirmed year range tuples; simplified imports.
Malaysia holidays data
holidays/countries/malaysia.py
Removed detailed year mappings for Lunar New Year and Islamic holidays; added confirmed year range tuples; simplified imports.
Mali Islamic holidays data
holidays/countries/mali.py
Removed select years from Eid and Mawlid dates; added confirmed year range tuples; simplified imports.
Mauritius Islamic holidays data
holidays/countries/mauritius.py
Removed select years from Eid al-Fitr dates; added confirmed year range tuple.
Montenegro Islamic holidays data
holidays/countries/montenegro.py
Removed early year entries from Eid date dictionaries; added confirmed year range tuples; simplified imports.
Nepal Islamic holidays data
holidays/countries/nepal.py
Moved class declarations; added confirmed year range tuples; removed one year entry from Eid al-Fitr dates.
Niger Islamic holidays data
holidays/countries/niger.py
Added alias classes NE and NER; removed multiple years from Islamic holiday date dictionaries; added confirmed year range tuples.
North Macedonia Islamic holidays data
holidays/countries/north_macedonia.py
Removed multiple years from Eid date dictionaries; added confirmed year range tuples; simplified imports.
Oman Islamic holidays data
holidays/countries/oman.py
Removed multiple year entries from Islamic holiday date dictionaries; added confirmed year range tuples; simplified imports.
Pakistan Islamic holidays data
holidays/countries/pakistan.py
Removed many years from holiday date dictionaries; added confirmed year range tuples.
Palestine Islamic holidays data
holidays/countries/palestine.py
Removed Mawlid date dictionary; added confirmed year range tuple; simplified imports.
Philippines holidays data
holidays/countries/philippines.py
Removed detailed year mappings for Lunar New Year and Islamic holidays; added confirmed year range tuples.
Qatar Islamic holidays data
holidays/countries/qatar.py
Removed multiple years from Eid date dictionaries; added confirmed year range tuples; simplified imports.
Saudi Arabia Islamic holidays data
holidays/countries/saudi_arabia.py
Added confirmed year range tuples for Eid holidays; no other changes.
Senegal Islamic holidays data
holidays/countries/senegal.py
Removed multiple years from holiday date dictionaries; added confirmed year range tuples; removed entire Mawlid dictionary.
Sierra Leone Islamic holidays data
holidays/countries/sierra_leone.py
Removed multiple year entries from Eid and Mawlid dates; added confirmed year range tuples; simplified imports.
Singapore holidays data
holidays/countries/singapore.py
Removed many historical year entries from Lunar New Year and Eid date dictionaries; added confirmed year range tuples.
Spain Islamic holidays data
holidays/countries/spain.py
Removed multiple years from Eid date dictionaries; added confirmed year range tuples; simplified imports.
Sri Lanka Islamic holidays data
holidays/countries/sri_lanka.py
Removed several years from Eid and Mawlid date dictionaries; added confirmed year range tuples.
Suriname Islamic holidays data
holidays/countries/suriname.py
Moved alias classes; removed multiple years from Eid date dictionaries; added confirmed year range tuples; simplified imports.
Tanzania Islamic holidays data
holidays/countries/tanzania.py
Removed select years from Eid and Mawlid date dictionaries; added confirmed year range tuples.
Timor Leste Islamic holidays data
holidays/countries/timor_leste.py
Removed multiple years from Eid date dictionaries; added confirmed year range tuples.
Togo Islamic holidays data
holidays/countries/togo.py
Removed multiple years from Eid and Ramadan beginning date dictionaries; added confirmed year range tuples; simplified imports.
Trinidad and Tobago Islamic holidays data
holidays/countries/trinidad_and_tobago.py
Removed multiple years from Eid al-Fitr dates; added confirmed year range tuple; simplified imports.
Turkey Islamic holidays data
holidays/countries/turkey.py
Removed many historical year entries from Eid date dictionaries; added confirmed year range tuples.
United Arab Emirates Islamic holidays data
holidays/countries/united_arab_emirates.py
Removed multiple year entries from Islamic holiday date dictionaries; added confirmed year range tuples; simplified imports.
Uzbekistan Islamic holidays data
holidays/countries/uzbekistan.py
Removed multiple years from Eid date dictionaries; added confirmed year range tuples; simplified imports.
Yemen Islamic holidays data
holidays/countries/yemen.py
Removed multiple holiday date dictionaries; replaced with confirmed year range tuples; reduced import constants; simplified data sets.
Snapshot update
snapshots/countries/NE_COMMON.json
Updated 2015 Eid al-Adha and Day after Eid al-Adha dates from estimated to confirmed.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

test

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Collaborator

@PPsyrius PPsyrius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice concept, I think this can be extended to other calendars as well i.e. Chinese & Hindu calendars

@KJhellico
Copy link
Collaborator Author

Yes, this can be applied to other Eastern calendars of similar type. Islamic is just an example.

@KJhellico KJhellico mentioned this pull request Jul 27, 2025
9 tasks
Copy link

codecov bot commented Jul 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ffbc1eb) to head (6f1851b).
⚠️ Report is 5 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##               dev     #2759    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          272       272            
  Lines        16246     16413   +167     
  Branches      2193      2193            
==========================================
+ Hits         16246     16413   +167     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1e072e and 0b6d6e2.

📒 Files selected for processing (2)
  • holidays/calendars/islamic.py (1 hunks)
  • holidays/countries/azerbaijan.py (1 hunks)
🧰 Additional context used
🧠 Learnings (32)
📓 Common learnings
Learnt from: KJhellico
PR: vacanza/holidays#2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.
Learnt from: PPsyrius
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:73-77
Timestamp: 2025-04-03T12:36:41.201Z
Learning: In the Holidays library, comments explaining year restrictions for holidays should be placed above the year check conditional statement, not inside it. Example format:
```python
# reason why goes here
if start_year <= self._year <= end_year:
    # Holiday name
    self._add_holiday_function(tr("Holiday Name"))
```
Learnt from: KJhellico
PR: vacanza/holidays#2593
File: holidays/countries/senegal.py:66-110
Timestamp: 2025-06-06T14:40:31.932Z
Learning: In the holidays library, within the _populate_public_holidays method, holidays should be arranged by calendar type (Islamic holidays first, then Gregorian holidays) without additional type grouping comments. The organization by calendar type is sufficient and follows the project's established conventions.
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: holidays/countries/finland.py:0-0
Timestamp: 2025-05-10T04:32:15.760Z
Learning: In the holidays package, detailed historical context and additional information should be added as comments at the method level or above conditional blocks, while comments directly above tr() function calls should only contain the holiday name itself (e.g., "# Independence Day.").
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:171-183
Timestamp: 2025-03-29T15:15:05.919Z
Learning: In the Fiji holidays implementation, the maintainers are aware of the need to extend the MAWLID_DATES dictionary beyond 2025 when future official references become available, and will do so when appropriate. No suggestions about extending this dictionary should be made in future reviews.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.
Learnt from: PPsyrius
PR: vacanza/holidays#2643
File: holidays/countries/mauritius.py:144-169
Timestamp: 2025-06-19T02:34:18.382Z
Learning: Custom holiday classes that extend _CustomHinduHolidays, _CustomIslamicHolidays, _CustomBuddhistHolidays, etc. in the holidays library do not use docstrings. They follow a pattern of using only inline comments above date dictionaries, as seen in Malaysia, Singapore, UAE, and other country implementations.
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:266-284
Timestamp: 2025-04-13T20:41:56.613Z
Learning: The Islamic holiday dates in the holidays library should only include officially verified dates, not predicted ones, to maintain accuracy. This is especially important for holidays that depend on lunar observations like Eid al-Fitr and Eid al-Adha.
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.
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.
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are properly covered by the test_eid_al_fitr_day() method, which tests both the regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Learnt from: PPsyrius
PR: vacanza/holidays#2388
File: holidays/countries/ivory_coast.py:84-85
Timestamp: 2025-03-30T08:08:30.415Z
Learning: Islamic holiday logic should be implemented in the holidays/groups/islamic.py file, with country-specific files only calling these methods with the appropriate translated names.
Learnt from: PPsyrius
PR: vacanza/holidays#2388
File: holidays/countries/ivory_coast.py:84-85
Timestamp: 2025-03-30T08:08:31.656Z
Learning: Islamic holiday logic should be implemented in the holidays/groups/islamic.py file, with country-specific files only calling these methods with the appropriate translated names.
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
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#2653
File: holidays/locale/th/LC_MESSAGES/TW.po:17-21
Timestamp: 2025-06-21T18:06:50.027Z
Learning: KJhellico's username includes a tilde character (~) as part of their nickname (appears as "~Jhellico" in Last-Translator headers), which is intentional formatting and not an error.
📚 Learning: the holidays codebase now uses the constructor signature pattern `__init__(self, *args, islamic_show...
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/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: in the holidays/calendars/islamic.py file, the islamic calendar date methods in the _islamiclunar cl...
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/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: custom holiday classes that extend _customhinduholidays, _customislamicholidays, _custombuddhistholi...
Learnt from: PPsyrius
PR: vacanza/holidays#2643
File: holidays/countries/mauritius.py:144-169
Timestamp: 2025-06-19T02:34:18.382Z
Learning: Custom holiday classes that extend _CustomHinduHolidays, _CustomIslamicHolidays, _CustomBuddhistHolidays, etc. in the holidays library do not use docstrings. They follow a pattern of using only inline comments above date dictionaries, as seen in Malaysia, Singapore, UAE, and other country implementations.

Applied to files:

  • holidays/countries/azerbaijan.py
📚 Learning: in the holidays library, `_customislamicholidays` subclasses follow a consistent pattern of not havi...
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/azerbaijan.py
📚 Learning: for the ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_ye...
Learnt from: PPsyrius
PR: vacanza/holidays#2490
File: holidays/countries/ethiopia.py:45-45
Timestamp: 2025-04-23T09:59:19.886Z
Learning: For the Ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_year` method to match the base class implementation in `holidays/holiday_base.py`, while keeping other methods without type hints to maintain consistency with other country implementations.

Applied to files:

  • holidays/countries/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: in the holidays library implementation, explicit holiday dates (like diwali in fiji) are only define...
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/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: the `_customislamicholidays` classes in this project contain only exact verified holiday dates from ...
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/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: in the holidays project, test methods for country holidays follow a standard form where year ranges ...
Learnt from: KJhellico
PR: vacanza/holidays#2530
File: tests/countries/test_andorra.py:23-28
Timestamp: 2025-05-06T21:07:11.577Z
Learning: In the holidays project, test methods for country holidays follow a standard form where year ranges are explicitly recreated in each test method rather than being stored as class variables, to maintain consistency across all country tests.

Applied to files:

  • holidays/countries/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun...
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • holidays/countries/azerbaijan.py
📚 Learning: for holiday tests in the vacanza/holidays project, structure tests by individual holidays rather tha...
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.

Applied to files:

  • holidays/countries/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, date dictionaries that map years to specific dates (like queens_birthday_da...
Learnt from: PPsyrius
PR: vacanza/holidays#2706
File: holidays/countries/cayman_islands.py:80-97
Timestamp: 2025-07-10T03:36:16.461Z
Learning: In the holidays library, date dictionaries that map years to specific dates (like queens_birthday_dates, special holiday dates, etc.) are typically defined within the _populate_public_holidays method rather than as module-level constants. This is the established library-wide pattern and should be maintained for consistency.

Applied to files:

  • holidays/countries/azerbaijan.py
📚 Learning: the islamic holiday dates in the holidays library should only include officially verified dates, not...
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:266-284
Timestamp: 2025-04-13T20:41:56.613Z
Learning: The Islamic holiday dates in the holidays library should only include officially verified dates, not predicted ones, to maintain accuracy. This is especially important for holidays that depend on lunar observations like Eid al-Fitr and Eid al-Adha.

Applied to files:

  • holidays/countries/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: islamic holiday logic should be implemented in the holidays/groups/islamic.py file, with country-spe...
Learnt from: PPsyrius
PR: vacanza/holidays#2388
File: holidays/countries/ivory_coast.py:84-85
Timestamp: 2025-03-30T08:08:30.415Z
Learning: Islamic holiday logic should be implemented in the holidays/groups/islamic.py file, with country-specific files only calling these methods with the appropriate translated names.

Applied to files:

  • holidays/countries/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, date dictionaries that map years to specific dates (like queens_birthday_da...
Learnt from: PPsyrius
PR: vacanza/holidays#2706
File: holidays/countries/cayman_islands.py:80-97
Timestamp: 2025-07-10T03:36:16.461Z
Learning: In the holidays library, date dictionaries that map years to specific dates (like queens_birthday_dates, spring_bank_dates, thanksgiving_day_dates, etc.) are typically defined within the _populate_public_holidays method rather than as module-level constants. This is the established library-wide pattern seen across multiple country implementations including United Kingdom, United States, Sri Lanka, and others.

Applied to files:

  • holidays/countries/azerbaijan.py
📚 Learning: in the guinea holidays implementation, observed eid al-fitr cases are properly covered by the test_e...
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are properly covered by the test_eid_al_fitr_day() method, which tests both the regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).

Applied to files:

  • holidays/countries/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: in the guinea holidays implementation, observed eid al-fitr cases are covered by the test_eid_al_fit...
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).

Applied to files:

  • holidays/countries/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: the "en" in the prodid line of the icalendar export (f"prodid:-//vacanza//open world holidays framew...
Learnt from: PPsyrius
PR: vacanza/holidays#2362
File: holidays/ical.py:176-180
Timestamp: 2025-03-26T08:50:03.504Z
Learning: The "EN" in the PRODID line of the iCalendar export (f"PRODID:-//Vacanza//Open World Holidays Framework v{self.holidays_version}//EN") should be kept as a fixed identifier by design, as agreed upon by the team, even though the actual holiday language may be different.

Applied to files:

  • holidays/countries/azerbaijan.py
📚 Learning: in the holidays library, the ramadan_beginning_dates dictionary in country-specific islamic holiday ...
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/azerbaijan.py
  • holidays/calendars/islamic.py
📚 Learning: the `islamic_show_estimated` parameter in country class constructors is only needed for countries th...
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/azerbaijan.py
📚 Learning: the `_customhinduholidays` mechanism works through `_customcalendartype` metaclass which renames pub...
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/azerbaijan.py
📚 Learning: in the holidays library, within the _populate_public_holidays method, holidays should be arranged by...
Learnt from: KJhellico
PR: vacanza/holidays#2593
File: holidays/countries/senegal.py:66-110
Timestamp: 2025-06-06T14:40:31.932Z
Learning: In the holidays library, within the _populate_public_holidays method, holidays should be arranged by calendar type (Islamic holidays first, then Gregorian holidays) without additional type grouping comments. The organization by calendar type is sufficient and follows the project's established conventions.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the vacanza/holidays project, country test files consistently use range(start_year, 2050) which i...
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: the standard behavior for calendar date methods in the holidays library is to return `(none, true)` ...
Learnt from: KJhellico
PR: vacanza/holidays#2437
File: holidays/calendars/tibetan.py:805-810
Timestamp: 2025-04-08T14:50:15.325Z
Learning: The standard behavior for calendar date methods in the holidays library is to return `(None, True)` when a requested year is not found in the date dictionary, rather than raising an exception or requiring documentation for out-of-range years.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, newer implementations use `start_year` to indicate the earliest year with c...
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, comments explaining year restrictions for holidays should be placed above t...
Learnt from: PPsyrius
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:73-77
Timestamp: 2025-04-03T12:36:41.201Z
Learning: In the Holidays library, comments explaining year restrictions for holidays should be placed above the year check conditional statement, not inside it. Example format:
```python
# reason why goes here
if start_year <= self._year <= end_year:
    # Holiday name
    self._add_holiday_function(tr("Holiday Name"))
```

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: the holidays project prioritizes complete historical coverage in tests, verifying holidays from thei...
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, the base `holidaybase._populate()` method already includes a guard clause t...
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the vacanza/holidays project tests, when testing holidays that span multiple consecutive days acr...
Learnt from: PPsyrius
PR: vacanza/holidays#2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays project, test files follow a dual testing approach: individual methods test specific...
Learnt from: PPsyrius
PR: vacanza/holidays#2386
File: tests/countries/test_nepal.py:499-536
Timestamp: 2025-04-05T06:49:06.217Z
Learning: In the holidays project, test files follow a dual testing approach: individual methods test specific holidays across multiple years, while comprehensive year-specific tests (e.g., `test_2025`) verify all holidays for a specific year in a single assertion. Both approaches serve different testing purposes and complement each other.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: the holidays library prioritizes full test coverage over performance in test suites. modern library-...
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: the holidays library doesn't currently have helper functions like `_add_holiday_span` for adding con...
Learnt from: PPsyrius
PR: vacanza/holidays#2601
File: holidays/countries/mongolia.py:140-146
Timestamp: 2025-06-15T11:50:44.366Z
Learning: The holidays library doesn't currently have helper functions like `_add_holiday_span` for adding consecutive multi-day holidays. Countries like Mongolia, Thailand, and Vietnam implement multi-day holiday spans using inline loops with `_timedelta(dt, delta)` pattern.

Applied to files:

  • holidays/calendars/islamic.py
🧬 Code Graph Analysis (1)
holidays/calendars/islamic.py (2)
holidays/calendars/custom.py (1)
  • _CustomCalendar (33-34)
holidays/helpers.py (1)
  • _normalize_tuple (39-49)
⏰ 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 build on windows-latest

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b6d6e2 and d993b84.

📒 Files selected for processing (1)
  • holidays/calendars/islamic.py (1 hunks)
🧰 Additional context used
🧠 Learnings (31)
📓 Common learnings
Learnt from: KJhellico
PR: vacanza/holidays#2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.
Learnt from: KJhellico
PR: vacanza/holidays#2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.
Learnt from: PPsyrius
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:73-77
Timestamp: 2025-04-03T12:36:41.201Z
Learning: In the Holidays library, comments explaining year restrictions for holidays should be placed above the year check conditional statement, not inside it. Example format:
```python
# reason why goes here
if start_year <= self._year <= end_year:
    # Holiday name
    self._add_holiday_function(tr("Holiday Name"))
```
Learnt from: KJhellico
PR: vacanza/holidays#2593
File: holidays/countries/senegal.py:66-110
Timestamp: 2025-06-06T14:40:31.932Z
Learning: In the holidays library, within the _populate_public_holidays method, holidays should be arranged by calendar type (Islamic holidays first, then Gregorian holidays) without additional type grouping comments. The organization by calendar type is sufficient and follows the project's established conventions.
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: holidays/countries/finland.py:0-0
Timestamp: 2025-05-10T04:32:15.760Z
Learning: In the holidays package, detailed historical context and additional information should be added as comments at the method level or above conditional blocks, while comments directly above tr() function calls should only contain the holiday name itself (e.g., "# Independence Day.").
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:171-183
Timestamp: 2025-03-29T15:15:05.919Z
Learning: In the Fiji holidays implementation, the maintainers are aware of the need to extend the MAWLID_DATES dictionary beyond 2025 when future official references become available, and will do so when appropriate. No suggestions about extending this dictionary should be made in future reviews.
Learnt from: PPsyrius
PR: vacanza/holidays#2642
File: tests/countries/test_france.py:24-27
Timestamp: 2025-06-18T10:10:46.158Z
Learning: The holidays library prioritizes full test coverage over performance in test suites. Modern library-wide standards favor comprehensive testing across all subdivisions and wide year ranges (e.g., 1803-2050 for France) to ensure thorough validation, even if it creates many test objects.
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:266-284
Timestamp: 2025-04-13T20:41:56.613Z
Learning: The Islamic holiday dates in the holidays library should only include officially verified dates, not predicted ones, to maintain accuracy. This is especially important for holidays that depend on lunar observations like Eid al-Fitr and Eid al-Adha.
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.
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.
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are properly covered by the test_eid_al_fitr_day() method, which tests both the regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
Learnt from: PPsyrius
PR: vacanza/holidays#2388
File: holidays/countries/ivory_coast.py:84-85
Timestamp: 2025-03-30T08:08:30.415Z
Learning: Islamic holiday logic should be implemented in the holidays/groups/islamic.py file, with country-specific files only calling these methods with the appropriate translated names.
Learnt from: PPsyrius
PR: vacanza/holidays#2388
File: holidays/countries/ivory_coast.py:84-85
Timestamp: 2025-03-30T08:08:31.656Z
Learning: Islamic holiday logic should be implemented in the holidays/groups/islamic.py file, with country-specific files only calling these methods with the appropriate translated names.
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).
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#2653
File: holidays/locale/th/LC_MESSAGES/TW.po:17-21
Timestamp: 2025-06-21T18:06:50.027Z
Learning: KJhellico's username includes a tilde character (~) as part of their nickname (appears as "~Jhellico" in Last-Translator headers), which is intentional formatting and not an error.
📚 Learning: the `_customislamicholidays` classes in this project contain only exact verified holiday dates from ...
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/calendars/islamic.py
📚 Learning: in the holidays/calendars/islamic.py file, the islamic calendar date methods in the _islamiclunar cl...
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/calendars/islamic.py
📚 Learning: the holidays codebase now uses the constructor signature pattern `__init__(self, *args, islamic_show...
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/calendars/islamic.py
📚 Learning: the islamic holiday dates in the holidays library should only include officially verified dates, not...
Learnt from: KJhellico
PR: vacanza/holidays#2386
File: holidays/countries/nepal.py:266-284
Timestamp: 2025-04-13T20:41:56.613Z
Learning: The Islamic holiday dates in the holidays library should only include officially verified dates, not predicted ones, to maintain accuracy. This is especially important for holidays that depend on lunar observations like Eid al-Fitr and Eid al-Adha.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: islamic holiday logic should be implemented in the holidays/groups/islamic.py file, with country-spe...
Learnt from: PPsyrius
PR: vacanza/holidays#2388
File: holidays/countries/ivory_coast.py:84-85
Timestamp: 2025-03-30T08:08:31.656Z
Learning: Islamic holiday logic should be implemented in the holidays/groups/islamic.py file, with country-specific files only calling these methods with the appropriate translated names.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library implementation, explicit holiday dates (like diwali in fiji) are only define...
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/calendars/islamic.py
📚 Learning: the `islamic_show_estimated` parameter in country class constructors is only needed for countries th...
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/calendars/islamic.py
📚 Learning: in the holidays library, the ramadan_beginning_dates dictionary in country-specific islamic holiday ...
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/calendars/islamic.py
📚 Learning: in the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun...
Learnt from: Wasif-Shahzad
PR: vacanza/holidays#2409
File: holidays/countries/qatar.py:27-46
Timestamp: 2025-04-03T16:58:27.175Z
Learning: In the holidays library, method names like `_add_holiday_2nd_tue_of_feb()` and `_add_holiday_1st_sun_of_mar()` use calendar constants internally through parent class implementations even when these constants don't appear directly in the file. Removing imports that seem unused based on a simple text search could break functionality.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the vacanza/holidays project, country test files consistently use range(start_year, 2050) which i...
Learnt from: PPsyrius
PR: vacanza/holidays#2629
File: tests/countries/test_namibia.py:22-23
Timestamp: 2025-06-14T10:58:43.636Z
Learning: In the vacanza/holidays project, country test files consistently use range(start_year, 2050) which intentionally excludes 2050 and stops at 2049. This is a library-wide implementation pattern, not an off-by-one error.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: for holiday tests in the vacanza/holidays project, structure tests by individual holidays rather tha...
Learnt from: PPsyrius
PR: vacanza/holidays#2416
File: tests/countries/test_turkmenistan.py:52-64
Timestamp: 2025-04-05T04:47:27.213Z
Learning: For holiday tests in the vacanza/holidays project, structure tests by individual holidays rather than by years. Each test method should focus on a specific holiday and test it across multiple years (from start_year through 2050) using helper methods like `assertHolidayName`. For fixed holidays, use generators like `(f"{year}-01-01" for year in range(1991, 2051))`. For movable holidays, specify individual dates for specific years followed by a range check.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: the standard behavior for calendar date methods in the holidays library is to return `(none, true)` ...
Learnt from: KJhellico
PR: vacanza/holidays#2437
File: holidays/calendars/tibetan.py:805-810
Timestamp: 2025-04-08T14:50:15.325Z
Learning: The standard behavior for calendar date methods in the holidays library is to return `(None, True)` when a requested year is not found in the date dictionary, rather than raising an exception or requiring documentation for out-of-range years.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, newer implementations use `start_year` to indicate the earliest year with c...
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:48-50
Timestamp: 2025-06-14T11:05:21.250Z
Learning: In the holidays library, newer implementations use `start_year` to indicate the earliest year with complete holiday data coverage, not necessarily the first year a holiday existed. If a holiday system starts partway through a year (like Nauru's Public Holidays Act starting Jan 31, 1968), the start_year should be set to the following year (1969) to ensure users get full annual holiday coverage.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, comments explaining year restrictions for holidays should be placed above t...
Learnt from: PPsyrius
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:73-77
Timestamp: 2025-04-03T12:36:41.201Z
Learning: In the Holidays library, comments explaining year restrictions for holidays should be placed above the year check conditional statement, not inside it. Example format:
```python
# reason why goes here
if start_year <= self._year <= end_year:
    # Holiday name
    self._add_holiday_function(tr("Holiday Name"))
```

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: the holidays project prioritizes complete historical coverage in tests, verifying holidays from thei...
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: tests/countries/test_finland.py:23-26
Timestamp: 2025-05-09T18:36:09.607Z
Learning: The holidays project prioritizes complete historical coverage in tests, verifying holidays from their first year of observance (e.g., 1853 for Finland) through future projections, rather than using shorter sliding windows.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays project, test methods for country holidays follow a standard form where year ranges ...
Learnt from: KJhellico
PR: vacanza/holidays#2530
File: tests/countries/test_andorra.py:23-28
Timestamp: 2025-05-06T21:07:11.577Z
Learning: In the holidays project, test methods for country holidays follow a standard form where year ranges are explicitly recreated in each test method rather than being stored as class variables, to maintain consistency across all country tests.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, the base `holidaybase._populate()` method already includes a guard clause t...
Learnt from: PPsyrius
PR: vacanza/holidays#2609
File: holidays/countries/nauru.py:57-60
Timestamp: 2025-06-14T11:04:31.180Z
Learning: In the holidays library, the base `HolidayBase._populate()` method already includes a guard clause that prevents holiday population methods like `_populate_public_holidays()` from being called when the year is before `start_year` or after `end_year`. Therefore, individual country implementations do not need to add their own guard clauses for years before independence or other start dates.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the vacanza/holidays project tests, when testing holidays that span multiple consecutive days acr...
Learnt from: PPsyrius
PR: vacanza/holidays#2601
File: tests/countries/test_mongolia.py:128-156
Timestamp: 2025-06-15T11:52:39.572Z
Learning: In the vacanza/holidays project tests, when testing holidays that span multiple consecutive days across many years (like Mongolia's National Festival spanning July 11-13), prefer explicit for loops over complex nested generator expressions with unpacking. The explicit loops are more readable, easier to maintain, and better communicate the testing intent even though the Big O complexity is equivalent.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays project, test files follow a dual testing approach: individual methods test specific...
Learnt from: PPsyrius
PR: vacanza/holidays#2386
File: tests/countries/test_nepal.py:499-536
Timestamp: 2025-04-05T06:49:06.217Z
Learning: In the holidays project, test files follow a dual testing approach: individual methods test specific holidays across multiple years, while comprehensive year-specific tests (e.g., `test_2025`) verify all holidays for a specific year in a single assertion. Both approaches serve different testing purposes and complement each other.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: when reviewing holiday implementations in the holidays library, defer to the maintainers' choice of ...
Learnt from: KJhellico
PR: vacanza/holidays#2777
File: holidays/countries/gambia.py:120-122
Timestamp: 2025-08-03T13:48:11.910Z
Learning: When reviewing holiday implementations in the holidays library, defer to the maintainers' choice of start years for specific holiday policies, as they likely have access to more reliable primary sources and official documentation than what can be found through web searches.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the guinea holidays implementation, observed eid al-fitr cases are properly covered by the test_e...
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are properly covered by the test_eid_al_fitr_day() method, which tests both the regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: for the ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_ye...
Learnt from: PPsyrius
PR: vacanza/holidays#2490
File: holidays/countries/ethiopia.py:45-45
Timestamp: 2025-04-23T09:59:19.886Z
Learning: For the Ethiopia holidays class, it's appropriate to add a return type hint only to the `_is_leap_year` method to match the base class implementation in `holidays/holiday_base.py`, while keeping other methods without type hints to maintain consistency with other country implementations.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: custom holiday classes that extend _customhinduholidays, _customislamicholidays, _custombuddhistholi...
Learnt from: PPsyrius
PR: vacanza/holidays#2643
File: holidays/countries/mauritius.py:144-169
Timestamp: 2025-06-19T02:34:18.382Z
Learning: Custom holiday classes that extend _CustomHinduHolidays, _CustomIslamicHolidays, _CustomBuddhistHolidays, etc. in the holidays library do not use docstrings. They follow a pattern of using only inline comments above date dictionaries, as seen in Malaysia, Singapore, UAE, and other country implementations.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays package, detailed historical context and additional information should be added as c...
Learnt from: PPsyrius
PR: vacanza/holidays#2537
File: holidays/countries/finland.py:0-0
Timestamp: 2025-05-10T04:32:15.760Z
Learning: In the holidays package, detailed historical context and additional information should be added as comments at the method level or above conditional blocks, while comments directly above tr() function calls should only contain the holiday name itself (e.g., "# Independence Day.").

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, `_customislamicholidays` subclasses follow a consistent pattern of not havi...
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/calendars/islamic.py
📚 Learning: kjhellico prefers to focus on completing and reviewing the main holiday implementation code before d...
Learnt from: KJhellico
PR: vacanza/holidays#2631
File: tests/countries/test_sint_maarten.py:62-0
Timestamp: 2025-06-14T21:12:07.224Z
Learning: KJhellico prefers to focus on completing and reviewing the main holiday implementation code before doing detailed reviews of the corresponding test files.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the holidays library, within the _populate_public_holidays method, holidays should be arranged by...
Learnt from: KJhellico
PR: vacanza/holidays#2593
File: holidays/countries/senegal.py:66-110
Timestamp: 2025-06-06T14:40:31.932Z
Learning: In the holidays library, within the _populate_public_holidays method, holidays should be arranged by calendar type (Islamic holidays first, then Gregorian holidays) without additional type grouping comments. The organization by calendar type is sufficient and follows the project's established conventions.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the fiji holidays implementation, the maintainers are aware of the need to extend the mawlid_date...
Learnt from: KJhellico
PR: vacanza/holidays#2354
File: holidays/countries/fiji.py:171-183
Timestamp: 2025-03-29T15:15:05.919Z
Learning: In the Fiji holidays implementation, the maintainers are aware of the need to extend the MAWLID_DATES dictionary beyond 2025 when future official references become available, and will do so when appropriate. No suggestions about extending this dictionary should be made in future reviews.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: references in holidays classes should only be included if they're used for test case cross-checks or...
Learnt from: PPsyrius
PR: vacanza/holidays#2489
File: holidays/countries/sao_tome_and_principe.py:22-26
Timestamp: 2025-04-23T14:55:35.504Z
Learning: References in holidays classes should only be included if they're used for test case cross-checks or provide historical context about when holidays were added/removed, not just for the sake of having more references.

Applied to files:

  • holidays/calendars/islamic.py
📚 Learning: in the guinea holidays implementation, observed eid al-fitr cases are covered by the test_eid_al_fit...
Learnt from: KJhellico
PR: vacanza/holidays#2398
File: holidays/countries/guinea.py:106-110
Timestamp: 2025-04-04T10:52:41.546Z
Learning: In the Guinea holidays implementation, observed Eid al-Fitr cases are covered by the test_eid_al_fitr_day() method, which tests both regular holiday dates and the observed dates when the holiday falls on a non-working day (for years >= 2023).

Applied to files:

  • holidays/calendars/islamic.py
⏰ 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 build on windows-latest
🔇 Additional comments (1)
holidays/calendars/islamic.py (1)

3973-3991: Clean implementation of the confirmed year range feature.

The logic elegantly handles both confirmed dates and year ranges. The use of _normalize_tuple ensures consistent handling of single ranges and multiple range tuples, and the any() with generator expression efficiently checks if a year falls within any confirmed range.

@KJhellico KJhellico changed the title Add checked year range support for custom calendars [PoC] Add confirmed year range support for custom calendars Aug 5, 2025
Copy link

sonarqubecloud bot commented Aug 5, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
12.3% Duplication on New Code (required ≤ 5%)

See analysis details on SonarQube Cloud

@KJhellico KJhellico marked this pull request as ready for review August 5, 2025 17:46
@KJhellico KJhellico changed the title Add confirmed year range support for custom calendars Add confirmed years range support for custom calendars Aug 5, 2025
@arkid15r arkid15r enabled auto-merge August 6, 2025 22:45
Copy link
Collaborator

@arkid15r arkid15r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Copy link
Collaborator

@PPsyrius PPsyrius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Hindu holidays could probably use a similar treatment as well, but let's do that in a separate PR.

@arkid15r arkid15r added this pull request to the merge queue Aug 7, 2025
Merged via the queue into vacanza:dev with commit df06bbc Aug 7, 2025
35 of 36 checks passed
@PPsyrius PPsyrius mentioned this pull request Aug 7, 2025
9 tasks
@KJhellico KJhellico deleted the add-checked-range branch August 7, 2025 19:19
@KJhellico KJhellico mentioned this pull request Aug 8, 2025
9 tasks
@arkid15r arkid15r changed the title Add confirmed years range support for custom calendars Implement confirmed years range support for custom calendars Aug 12, 2025
@arkid15r arkid15r mentioned this pull request Aug 18, 2025
This was referenced Sep 10, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 3, 2025
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载