Update Saudi Arabia calendar: Founding Day and Eid Al-Adha through 2029 - #2688
Open
PureSaber wants to merge 1 commit into
Open
Update Saudi Arabia calendar: Founding Day and Eid Al-Adha through 2029#2688PureSaber wants to merge 1 commit into
PureSaber wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
lballabio
reviewed
Jul 31, 2026
Comment on lines
+83
to
+84
| // Approximate Gregorian Eid al-Adha dates; holiday window Eid-1..Eid+4 | ||
| // as used historically for Tadawul (see Saudi Exchange holiday calendar). |
Owner
There was a problem hiding this comment.
Instead of using an approximation, we could change the code here so that the dates are correct. I'd suggest something like
static std::vector<std::pair<Date,Date>> EidAlAdha = {
{Date(6, April, 1998),Date(11, April, 1998)},
{Date(26, March, 1999),Date(31, March, 1999)},
...
};
return std::any_of(EidAlAdha.begin(), EidAlAdha.end(),
[=](auto p) { return d >= p.first && d <= p.second; });
What do you think?
Comment on lines
+167
to
+168
| || (d == 22 && m == February && y >= 2022 && y != 2025) | ||
| || (d == 23 && m == February && y == 2025) |
Owner
There was a problem hiding this comment.
If the rule is that the holiday rolls on the next Sunday when it falls on a Friday or a Saturday, you can write it as a generic rule instead of maintaining the present and future exceptions such as 2025:
|| ((d == 22 || ((d == 23 || d == 24) && w == Sunday)) && m == February && y >= 2022)
You'll have to add Weekday w = date.weekday(); at the beginning of the method.
I would also add a short test case for this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
<vector>and refresh header docs (weekend change in 2013, Founding Day, exchange URL).Source: Saudi Exchange holiday calendar.
Test plan
Made with Cursor