JalaliCalendar
extends CalendarSystem
in package
Defines validation, conversion, and calendar-length behavior for the Jalali calendar.
Table of Contents
Constants
- MAX_YEAR : int = \Kampute\CivilDate\Support\VernalEquinoxCalcula...
- Maximum supported Jalali year with a known following Nowruz.
- MIN_YEAR : int = \Kampute\CivilDate\Support\VernalEquinoxCalcula...
- Minimum supported Jalali year.
Methods
- assertValidDay() : void
- Validates a calendar day.
- assertValidMonth() : void
- Validates a calendar month.
- assertValidYear() : void
- Validates a Jalali year.
- daysInMonth() : int
- Returns the number of days in a Jalali month.
- daysInYear() : int
- Returns the number of days in a Jalali year.
- id() : Calendar
- Returns the Jalali calendar identifier.
- instance() : static
- Returns the shared instance for the concrete calendar system.
- isLeapYear() : bool
- Determines whether a Jalali year is leap.
- isValidDay() : bool
- Determines whether a day number is valid for a calendar month.
- isValidMonth() : bool
- Determines whether a month number is valid for a calendar year.
- isValidYear() : bool
- Determines whether a Jalali year is valid and within the supported astronomical range.
- monthsInYear() : int
- Returns the number of months in a year.
- toDayOfYear() : int
- Converts Jalali date components to a day of year value.
- todayTimeZone() : DateTimeZone
- Returns the fixed Iran Standard Time timezone used to resolve today's Jalali date.
- toJDN() : int
- Converts calendar date components to a Julian Day Number.
- toMonthDay() : array{0: int, 1: int}
- Converts a day of year value to Jalali month and day components.
- toYearMonthDay() : array{0: int, 1: int, 2: int}
- Converts a Julian Day Number to calendar year, month, and day components.
- vernalEquinox() : DateTimeImmutable
- Returns the vernal equinox date and time in Iran Standard Time for a Jalali year.
- findYear() : int
- Finds the Jalali year containing a Julian Day Number.
- firstDayOfYearJDN() : int
- Returns the Julian Day Number of the first day of a Jalali year.
Constants
MAX_YEAR
Maximum supported Jalali year with a known following Nowruz.
public
int
MAX_YEAR
= \Kampute\CivilDate\Support\VernalEquinoxCalculator::MAX_SUPPORTED_YEAR - self::JALALI_TO_GREGORIAN_OFFSET - 1
MIN_YEAR
Minimum supported Jalali year.
public
int
MIN_YEAR
= \Kampute\CivilDate\Support\VernalEquinoxCalculator::MIN_SUPPORTED_YEAR - self::JALALI_TO_GREGORIAN_OFFSET
Methods
assertValidDay()
Validates a calendar day.
public
final assertValidDay(int $year, int $month, int $day) : void
Parameters
- $year : int
-
Calendar year.
- $month : int
-
Calendar month number.
- $day : int
-
Calendar day of month.
Tags
assertValidMonth()
Validates a calendar month.
public
final assertValidMonth(int $year, int $month) : void
Parameters
- $year : int
-
Calendar year.
- $month : int
-
Calendar month number.
Tags
assertValidYear()
Validates a Jalali year.
public
assertValidYear(int $year) : void
Parameters
- $year : int
-
Jalali year.
Tags
daysInMonth()
Returns the number of days in a Jalali month.
public
daysInMonth(int $year, int $month) : int
Parameters
- $year : int
-
Jalali year.
- $month : int
-
Jalali month number.
Tags
Return values
int —Number of days in the month.
daysInYear()
Returns the number of days in a Jalali year.
public
daysInYear(int $year) : int
Parameters
- $year : int
-
Jalali year.
Tags
Return values
int —Number of days in the year.
id()
Returns the Jalali calendar identifier.
public
id() : Calendar
Tags
Return values
Calendar —Jalali calendar identifier.
instance()
Returns the shared instance for the concrete calendar system.
public
final static instance() : static
Tags
Return values
static —Calendar system instance.
isLeapYear()
Determines whether a Jalali year is leap.
public
isLeapYear(int $year) : bool
Parameters
- $year : int
-
Jalali year.
Tags
Return values
bool —True when the year is leap, false otherwise.
isValidDay()
Determines whether a day number is valid for a calendar month.
public
isValidDay(int $year, int $month, int $day) : bool
Parameters
- $year : int
-
Calendar year.
- $month : int
-
Calendar month number.
- $day : int
-
Calendar day of month.
Return values
bool —True when the day is valid, false otherwise.
isValidMonth()
Determines whether a month number is valid for a calendar year.
public
isValidMonth(int $year, int $month) : bool
Parameters
- $year : int
-
Calendar year.
- $month : int
-
Calendar month number.
Return values
bool —True when the month is valid, false otherwise.
isValidYear()
Determines whether a Jalali year is valid and within the supported astronomical range.
public
isValidYear(int $year) : bool
Parameters
- $year : int
-
Jalali year.
Tags
Return values
bool —True when the year is valid and supported, false otherwise.
monthsInYear()
Returns the number of months in a year.
public
monthsInYear(int $year) : int
Parameters
- $year : int
-
Calendar year.
Tags
Return values
int —Number of months in the year.
toDayOfYear()
Converts Jalali date components to a day of year value.
public
toDayOfYear(int $year, int $month, int $day) : int
Parameters
- $year : int
-
Jalali year.
- $month : int
-
Jalali month number.
- $day : int
-
Jalali day of month.
Tags
Return values
int —Day of year, where 1 is the first day of the year.
todayTimeZone()
Returns the fixed Iran Standard Time timezone used to resolve today's Jalali date.
public
todayTimeZone() : DateTimeZone
Tags
Return values
DateTimeZone —Fixed Iran Standard Time timezone.
toJDN()
Converts calendar date components to a Julian Day Number.
public
toJDN(int $year, int $month, int $day) : int
Parameters
- $year : int
-
Calendar year.
- $month : int
-
Calendar month number.
- $day : int
-
Calendar day of month.
Tags
Return values
int —Julian Day Number.
toMonthDay()
Converts a day of year value to Jalali month and day components.
public
toMonthDay(int $year, int $dayOfYear) : array{0: int, 1: int}
Parameters
- $year : int
-
Jalali year.
- $dayOfYear : int
-
Day of year, where 1 is the first day of the year.
Tags
Return values
array{0: int, 1: int} —Jalali [month, day] components.
toYearMonthDay()
Converts a Julian Day Number to calendar year, month, and day components.
public
toYearMonthDay(int $jdn) : array{0: int, 1: int, 2: int}
Parameters
- $jdn : int
-
Julian Day Number.
Tags
Return values
array{0: int, 1: int, 2: int} —Calendar [year, month, day] components.
vernalEquinox()
Returns the vernal equinox date and time in Iran Standard Time for a Jalali year.
public
vernalEquinox(int $year) : DateTimeImmutable
Parameters
- $year : int
-
Jalali year.
Tags
Return values
DateTimeImmutable —Equinox instant in Iran Standard Time (UTC+3:30).
findYear()
Finds the Jalali year containing a Julian Day Number.
protected
findYear(int $jdn) : int
Parameters
- $jdn : int
-
Julian Day Number.
Tags
Return values
int —Jalali year, or 0 when the JDN is outside the supported range.
firstDayOfYearJDN()
Returns the Julian Day Number of the first day of a Jalali year.
protected
firstDayOfYearJDN(int $year) : int
Parameters
- $year : int
-
Jalali year.
Tags
Return values
int —Julian Day Number of the year's first day.