Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Wessam Ahmed committed Jan 22, 2024
1 parent 125f0ad commit 6a33c92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Countries/Egypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ private function convertHijriToGregorianHolidays(array $hijriHolidays, int $year
private function getGregorianDateForHijriHoliday(string $hijriDate, int $hijriYear, int $gregorianYear): ?CarbonImmutable
{
[$month, $day] = explode('-', $hijriDate);
$currentYearDate = Hijri::convertToGregorian((int) $day, (int) $month, $hijriYear);

/**
* Converts a Hijri date to a Gregorian date and checks its alignment with the Gregorian year.
* Since a Hijri year is about 11 days shorter than a Gregorian year, we're checking
* if the converted date falls within the specified Gregorian year.
*/
$currentYearDate = Hijri::convertToGregorian((int) $day, (int) $month, $hijriYear);
if ($currentYearDate->format('Y') == $gregorianYear) {
return $currentYearDate->toImmutable();
}
Expand Down

0 comments on commit 6a33c92

Please sign in to comment.