29 public static function count($startDate, $endDate, ...$dateArgs)
35 $startDate = min($sDate, $eDate);
36 $endDate = max($sDate, $eDate);
41 foreach ($dateArgs as $holidayDate) {
45 return $e->getMessage();
49 $startDow = self::calcStartDow($startDate);
50 $endDow = self::calcEndDow($endDate);
51 $wholeWeekDays = (int) floor(($endDate - $startDate) / 7) * 5;
52 $partWeekDays = self::calcPartWeekDays($startDow, $endDow);
55 $holidayCountedArray = [];
56 foreach ($holidayArray as $holidayDate) {
57 if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
58 if ((
Week::day($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
60 $holidayCountedArray[] = $holidayDate;
65 return self::applySign($wholeWeekDays + $partWeekDays, $sDate, $eDate);
70 $startDow = 6 - (int)
Week::day($startDate, 2);
90 $partWeekDays = $endDow + $startDow;
91 if ($partWeekDays > 5) {
static calcStartDow(float $startDate)
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
static count($startDate, $endDate,... $dateArgs)
NETWORKDAYS.
static calcEndDow(float $endDate)
static calcPartWeekDays(int $startDow, int $endDow)
static day($dateValue, $style=1)
WEEKDAY.
static applySign(int $result, float $sDate, float $eDate)
static getDateValue($dateValue, bool $allowBool=true)
getDateValue.