Korin API

DateGrammar
in package

Read onlyYes
FinalYes

The GEDCOM 7.0 date types DateValue, DatePeriod and DateExact (specification section 2.6 and appendix A). Months and epochs come from the profile's calendars; month lengths are known here for the four standard calendars. Calendars and months that HEAD.SCHMA defines as standard ones are those ({@see Schema}); the months, epochs and days of other extension calendars are not known, so not checked.

Table of Contents

Constants

DATE  : mixed = '/^(?:(GREGORIAN|JULIAN|FRENCH_R|HEBREW|_[A-Z0-...
One date: calendar, day, month, year, epoch; also read by {@see \Korin\Gedcom\Model\GedcomDate}.
DAY_OUT_OF_RANGE  : mixed = 1
The payload follows the grammar, but a day is beyond the length of its month.
INVALID  : mixed = 2
The payload does not follow the grammar; outranks DAY_OUT_OF_RANGE.
VALID  : mixed = 0
The payload follows the grammar and every day fits its month.

Methods

__construct()  : mixed
check()  : self::VALID|self::DAY_OUT_OF_RANGE|self::INVALID
cycleYear()  : int
A year of any length as the year of the same place in the 400-year cycle: the last four digits keep leap years (and dual years, modulo 100) and do not overflow an int.
monthDays()  : int
Length of a month of GREGORIAN, JULIAN, HEBREW or FRENCH_R; also used for 5.x dates.

Constants

DATE

One date: calendar, day, month, year, epoch; also read by {@see \Korin\Gedcom\Model\GedcomDate}.

public mixed DATE = '/^(?:(GREGORIAN|JULIAN|FRENCH_R|HEBREW|_[A-Z0-9_]+) )?(?:(?:([0-9]+) )?([A-Z][A-Z0-9_]*|_[A-Z0-9_]+) )?([0-9]+)(?: (BCE|_[A-Z0-9_]+))?$/'

DAY_OUT_OF_RANGE

The payload follows the grammar, but a day is beyond the length of its month.

public mixed DAY_OUT_OF_RANGE = 1

INVALID

The payload does not follow the grammar; outranks DAY_OUT_OF_RANGE.

public mixed INVALID = 2

VALID

The payload follows the grammar and every day fits its month.

public mixed VALID = 0

Methods

__construct()

public __construct(array<string, array{uri: string, months: list, epochs: list}> $calendars[, array<string, string> $calendarAliases = [] ][, array<string, string> $monthAliases = [] ]) : mixed
Parameters
$calendars : array<string, array{uri: string, months: list, epochs: list}>
$calendarAliases : array<string, string> = []

extension tag => standard calendar

$monthAliases : array<string, string> = []

extension tag => standard month

check()

public check(string $type, string $value) : self::VALID|self::DAY_OUT_OF_RANGE|self::INVALID
Parameters
$type : string
$value : string
Return values
self::VALID|self::DAY_OUT_OF_RANGE|self::INVALID

cycleYear()

A year of any length as the year of the same place in the 400-year cycle: the last four digits keep leap years (and dual years, modulo 100) and do not overflow an int.

public static cycleYear(string $digits) : int
Parameters
$digits : string
Return values
int

monthDays()

Length of a month of GREGORIAN, JULIAN, HEBREW or FRENCH_R; also used for 5.x dates.

public static monthDays(string $calendar, string $month, int $year, bool $bce) : int
Parameters
$calendar : string
$month : string
$year : int
$bce : bool
Return values
int
On this page

Search results