Get the current season in format YYYY-YY based on the year.

@param int $year
@return string
@throws \InvalidArgumentException
543014
public static function fromYear(int $year): string
    {
        // note this checks SeasonYearParam::FORMAT (YYYY), not self::FORMAT
        if (preg_match(SeasonYearParam::FORMAT, (string) $year) !== 1) {
            throw new \InvalidArgumentException('Year must be an integer in YYYY format');
        }

        return $year.'-'.substr((string) ($year + 1), -2);
    }
283193
public function withYear(int $year) : ZonedDateTime
    {
        return ZonedDateTime::of($this->localDateTime->withYear($year), $this->timeZone);
    }
313941
public function addValidYear( $year )
	{
		if ( is_array( $year ) )
		{
			$this->validYears += $year;
		}
		elseif ( $year !== null )
		{
			$this->validYears[] = $year;
		}
	}
649011
public static function FirstDayInYearCarbon(int $year)
    {
        return \Carbon\Carbon::parse( \Phunc\Year::FirstDayInYear($year) );
    }
1218319
public function ymdToJd($year, $month, $day)
    {
        if ($month < 1 || $month > $this->monthsInYear()) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        }

        $epbase = $year - (($year >= 0) ? 474 : 473);
        $epyear = 474 + $this->mod($epbase, 2820);

        return
            $day +
            (($month <= 7) ? (($month - 1) * 31) : ((($month - 1) * 30) + 6)) +
            (int) ((($epyear * 682) - 110) / 2816) +
            ($epyear - 1) * 365 +
            (int) (floor($epbase / 2820)) * 1029983 +
            $this->jdStart() - 1;
    }
334398
public function getYear($format = self::YEAR_FORMAT_LONG)
    {
        if ($this->isHollow()) {
            return 0;
        }

        return (int) $this->format($format);
    }
274604
public static function firstWeekOfYear($year = null)
    {
        $year = $year ? (int) $year : Date('Y');
        return Carbon::parse($year . '-01-01')->startOfWeek(Carbon::SUNDAY);
    }
1205216
public function daysInMonth($year, $month)
    {
        if ($year < 1) {
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
        } elseif ($month < 1 || $month > 13) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        } elseif ($month == 2) {
            return $this->daysInMonthHeshvan($year);
        } elseif ($month == 3) {
            return $this->daysInMonthKislev($year);
        } elseif ($month == 6) {
            return $this->daysInMonthAdarI($year);
        } else {
            return self::$FIXED_MONTH_LENGTHS[$month];
        }
    }
156942
public function checkYear(int $year)
	{
		$y = date('Y');
		if ($y == $year) {
            return false;
		}
		$d1 = \Model::factory(UF::class)->whereLike('fecha', $year . '%')->count('id');
		$d0 = Carbon::parse($year . '-01-01');
		if ($d1 = (365 + $d0->format('L'))) {
			return true;
		}
		return false;
	}
556880
public function calendarMonthsInYear(string $calendar, int $year): array
    {
        $date          = new Date($calendar . ' ' . $year);
        $calendar_date = $date->minimumDate();
        $month_numbers = range(1, $calendar_date->monthsInYear());
        $month_names   = [];

        foreach ($month_numbers as $month_number) {
            $calendar_date->day   = 1;
            $calendar_date->month = $month_number;
            $calendar_date->setJdFromYmd();

            if ($month_number === 6 && $calendar_date instanceof JewishDate && !$calendar_date->isLeapYear()) {
                // No month 6 in Jewish non-leap years.
                continue;
            }

            if ($month_number === 7 && $calendar_date instanceof JewishDate && !$calendar_date->isLeapYear()) {
                // Month 7 is ADR in Jewish non-leap years (and ADS in others).
                $mon = 'ADR';
            } else {
                $mon = $calendar_date->format('%O');
            }

            $month_names[$mon] = $calendar_date->format('%F');
        }

        return $month_names;
    }
1299762
public static function schoolYearAtTime($year = null) {
		static::loadData();
		if (is_null($year)) return static::schoolYear();
		foreach(static::$arrDBCalendar as $sy) {
			//return graduation year of current school year if available
			if($sy['start'] < $year && $sy['end'] > $year) return date('Y',$sy['end']);
			//else - if a school year is found which begins later than now but already in the current calendar year, return the end year
			//-> summer holidays := following school year
			elseif($sy['start'] > $year && date('Y',$sy['start']) == date('Y')) return date('Y',$sy['end']);
		}
		return false;
	}
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;
    }
1368379
public function getAge($day, $month, $year) {
        $years = date('Y') - $year;
        if (date('m') < $month)
            $years--;
        elseif (date('d') < $day && date('m') == $month)
            $years--;

        return $years;
    }
606575
function(year) {
			var date = this._validate(year, this.minMonth, this.minDay, $.calendars.local.invalidYear);
			year = date.year();
			return this.toJD((year === -1 ? +1 : year + 1), 7, 1) - this.toJD(year, 7, 1);
		}
541608
public static function getFirstOfYear($year='')
    {
        if ($year == '')
        {
            $currentTime = time();
            $year = date('Y', $currentTime);
        }
        
        $timestamp = mktime(0, 0, 0, $month=1, $day=1, $year);
        
        return $timestamp;
    }
1214109
public static function isLeapYear($year = null): bool
    {
        $year = $year ? $year : date('Y');
        return ($year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0);
    }
258067
private function createOrthodoxSunday($year)
    {
        $a = $year % 4;
        $b = $year % 7;
        $c = $year % 19;
        $d = (19 * $c + 15) % 30;
        $e = (2 * $a + 4 * $b - $d + 34) % 7;
        $month = floor(($d + $e + 114) / 31);
        $day = (($d + $e + 114) % 31) + 1;

        $sunday = mktime(0, 0, 0, $month, $day + 13, $year);

        return new \DateTime(date('Y-m-d', $sunday));
    }