Returns all the days for the given month.

@param Month $month
@return DayInterface[]
2021
public function getDays(Month $month)
    {
        $days = array();

        for ($dayNo = 1; $dayNo <= $month->numberOfDays(); $dayNo++) {
            $days[$dayNo] = $this->getDay($month, $dayNo);
        }

        return $days;
    }
1088678
public function daysInMonth($year, $month)
    {
        if ($year === 0) {
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
        } elseif ($month < 1 || $month > 12) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        } elseif ($month === 1 || $month === 3 || $month === 5 || $month === 7 || $month === 8 || $month === 10 || $month === 12) {
            return 31;
        } elseif ($month === 4 || $month === 6 || $month === 9 || $month === 11) {
            return 30;
        } elseif ($this->isLeapYear($year)) {
            return 29;
        } else {
            return 28;
        }
    }
386969
private static function jdMonthNameCalendar(CalendarInterface $calendar, $julian_day, $months)
    {
        list(, $month) = $calendar->jdToYmd($julian_day);

        return $months[$month];
    }
776088
private function isValidMonth($month)
    {
        $list = array(
            self::MONTH_JANUARY,
            self::MONTH_FEBRUARY,
            self::MONTH_MARCH,
            self::MONTH_APRIL,
            self::MONTH_MAY,
            self::MONTH_JUNE,
            self::MONTH_JULY,
            self::MONTH_AUGUST,
            self::MONTH_SEPTEMBER,
            self::MONTH_OCTOBER,
            self::MONTH_NOVEMBER,
            self::MONTH_DECEMBER
        );

        return in_array($month, $list);
    }
514918
public function ymdToJd($year, $month, $day)
    {
        if ($month < 1 || $month > $this->monthsInYear()) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        }

        return $day + 29 * ($month - 1) + (int) ((6 * $month - 1) / 11) + $year * 354 + (int) ((3 + 11 * $year) / 30) + 1948085;
    }
1255502
public function withMonth(int $month) : ZonedDateTime
    {
        return ZonedDateTime::of($this->localDateTime->withMonth($month), $this->timeZone);
    }
1214768
public static function getDaysByMonthsOfYear($year = null): array
    {
        $year = $year ? $year : date('Y');
        $months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        if (self::isLeapYear($year)) $months [1] = 29;
        return $months;
    }
653585
public function getDays()
    {
        $days = array();
        foreach ($this->getDatePeriod() as $date) {
            $days[] = $this->getFactory()->createDay($date);
        }

        return $days;
    }
632596
public static function days_in_month($month, $year = null)
	{
		$year  = ! empty($year) ? (int) $year : (int) date('Y');
		$month = (int) $month;

		if ($month < 1 or $month > 12)
		{
			throw new \UnexpectedValueException('Invalid input for month given.');
		}
		elseif ($month == 2)
		{
			if ($year % 400 == 0 or ($year % 4 == 0 and $year % 100 != 0))
			{
				return 29;
			}
		}

		$days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
		return $days_in_month[$month-1];
	}
818940
public static function prevMonth($month, $year)
    {
        if ($year >= 1970) {
            if ($month == 1) {
                $prevMonth = 12;
                $yearMonth = $year - 1;
            } else {
                $prevMonth = $month - 1;
                $yearMonth = $year;
            }
        }

        return array('month' => $prevMonth, 'year' => $yearMonth);
    }
519958
function monthrange(year, month) {
      if(month < 1 || month > 12) {
        throw new IllegalMonthError();
      }

      var day1 = weekday(year, month, 1);
      var ndays = _DAYS_IN_MONTH[month] + (month === 2 && isleap(year));

      return [day1, ndays];
    }
1075619
public function setDate($year, $month, $day)
    {
        list($year, $month, $day) = self::getGregorian($year, $month, $day);

        return parent::setDate($year, $month, $day);
    }
45643
public function retrieveDay($day, $month = null) {
		$day = (int)$day;
		if ($day < 1 || $day > 31) {
			return 0;
		}

		// TODO check on month days!

		return $day;
	}
452621
public static function weekdays($num = 1): array
    {
        $days = [];
        $day = self::parse(Date('Y-m-d'));
        while (count($days) < $num) {
            if (!$day->isWeekend()) {
                $days[] = clone $day;
            }
            $day->addWeekday();
        }
        return $days;
    }
131190
public static function weekRangeInMonth($month, $year)
    {
        $year  = (int)$year;
        $month = (int)$month;
        if ($year < 1970) { // minimal unix time year 1970
            $month = date("n");
            $year  = date("Y");
        }
        if ($month <= 0 || $month > 12) {
            $month = date("n");
            $year  = date("Y");
        }
        if ($month < 10) {
            $month2 = '0' . $month;
        } else {
            $month2 = $month;
        }
        $weekAwal  = (int)$this->weekNumber($year . '-' . $month2 . '-01');
        $weekAkhir = (int)$this->weekNumber($year . '-' . $month2 . '-' . $this->maxDateInMonth($month, $year));
        /*
          echo $year.'-'.$month2.'-01';
          echo '<br />';
          echo $weekAwal;
          echo '<br />';
          echo $year.'-'.$month2.'-'.$this->getMaxDateInMonth($month,$year);
          echo '<br />';
          echo $weekAkhir;
         */
        if ($weekAwal > $weekAkhir) {
            $weekAwal = 1;
        }
        $a = 0;

        for ($i = $weekAwal; $i <= $weekAkhir; $i++) {
            $a++;
            $weekRange[$a] = (int)$i;
        }

        return $weekRange;
    }
267489
public function sub_month($months)
    {
        $this->time = strtotime("-$months months", $this->time);
        $this->set_timestamp($this->time);
        
        return $this;
    }
1369263
public static function daysInMonth(int $month, int $year = null)
    {
        // Redefine vars
        $year   = ! empty($year) ? $year : (int) date('Y');

        if ($month < 1 or $month > 12) {
            return false;
        } elseif ($month == 2) {
            if ($year % 400 == 0 or ($year % 4 == 0 and $year % 100 != 0)) {
                return 29;
            }
        }

        $days_in_month = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

        return $days_in_month[$month-1];
    }