This file contains 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
<?php | |
function is_federal_holiday(DateTime $date){ | |
$year = $date->format('Y'); | |
$federal_holidays = array_map(function($date_string) use($year){ | |
$date = new DateTime($date_string . ' ' . $year); | |
if ($date->format('l') === 'Saturday') $date->modify('-1 day'); | |
if ($date->format('l') === 'Sunday') $date->modify('+1 day'); | |
return $date; | |
}, [ | |
"january 1", //new year's day |
OlderNewer