Skip to content

Commit

Permalink
Update Bahrain.php
Browse files Browse the repository at this point in the history
  • Loading branch information
bo3bdo committed Feb 12, 2024
1 parent 060c1ae commit 01a2ec8
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/Countries/Bahrain.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,28 +209,4 @@ private function getIslamicHolidayDatesForYear(array $holidayDates, int $year, s

return $dates;
}



/**
* @return array<string, CarbonInterface>
*/
private function adjustForWeekend(string $name, CarbonImmutable $date): array
{
$adjustedHolidays = [];

// Explicitly define this logic to avoid timezone confusion on the CarbonInterface::next() method
if ($date->isFriday() || $date->isSaturday()) {
// If the holiday falls on a weekend (Friday or Saturday), it is observed on the following Sunday
$adjustedHolidays['Day off for '.$name] = $date->next(CarbonInterface::SUNDAY);
} elseif ($date->isSunday() || $date->isThursday()) {
// If the holiday falls on a Sunday or Thursday, it is observed on the same day
$adjustedHolidays[$name] = $date;
} else {
// If the holiday falls on a weekday (Monday, Tuesday, Wednesday), it is observed on the following Thursday
$adjustedHolidays['Day off for '.$name] = $date->next(CarbonInterface::THURSDAY);
}

return $adjustedHolidays;
}
}

0 comments on commit 01a2ec8

Please sign in to comment.