Refactor time splitter, support computing of dates for time entries

This commit is contained in:
Joshua Ramon Enslin 2024-04-16 23:21:34 +02:00
parent 2cdfa2e948
commit bd775bec45
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
7 changed files with 1006 additions and 534 deletions

View File

@ -82,14 +82,14 @@ final class NodaConsolidatedNamesForPersinst extends NodaConsolidatedNamesAbstra
$dateString = rtrim($parts[1], ')'); // $dateString = rtrim($parts[1], ')'); //
if (!empty($dates = NodaTimeSplitter::is_timespan($dateString)) if (!empty($dates = NodaTimeSplitter::is_timespan($dateString))
&& $dates[0] !== '?' && $dates->start_year !== '?'
&& $dates[1] !== '?' && $dates->end_year !== '?'
&& intval($dates[1]) - intval($dates[0]) < 150 && intval($dates->end_year) - intval($dates->start_year) < 150
) { ) {
return [ return [
'name' => $nameOnly, 'name' => $nameOnly,
'birth' => $dates[0], 'birth' => $dates->start_year,
'death' => $dates[1], 'death' => $dates->end_year,
]; ];
} }

View File

@ -0,0 +1,74 @@
<?PHP
/**
* Represents a time indicator (CE / BCE).
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a time indicator (CE / BCE).
*/
enum NodaCountingTimeIndicator implements JsonSerializable {
case ce;
case bce;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return NodaCountingTimeIndicator
*/
public static function fromString(string $input):NodaCountingTimeIndicator {
return match($input) {
'+' => self::ce,
'-' => self::bce,
'ce' => self::ce,
'bce' => self::bce,
default => throw new MDpageParameterNotFromListException("Unknown counting time indicator (bc / bce)"),
};
}
/**
* Returns a canonical string representation.
*
* @return string
*/
public function toString():string {
return match($this) {
self::ce => '+',
self::bce => '-',
};
}
/**
* Returns a canonical string representation.
*
* @return string
*/
public function toGerman():string {
return match($this) {
self::ce => ' n. Chr.',
self::bce => ' v. Chr.',
};
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->toString();
}
}

366
src/NodaSplitTime.php Normal file
View File

@ -0,0 +1,366 @@
<?PHP
/**
* Describes a time after splitting / transfer object.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Describes a time after splitting / transfer object.
*/
final class NodaSplitTime {
const DEFAULT_DATE = '0001-01-01';
public readonly string $start_year;
public readonly string $end_year;
public readonly string $counting_time_month;
public readonly string $counting_time_day;
public readonly NodaCountingTimeIndicator $counting_time_indicator;
public readonly NodaTimeBeforeAfterIndicator $before_after_indicator;
public string $start_date;
public string $end_date;
/**
* Returns a single, exact date.
*
* @param string $year Year.
* @param string $month Month.
* @param string $day Day.
*
* @return NodaSplitTime
*/
public static function genExactDate(string $year, string $month, string $day, NodaTimeBeforeAfterIndicator $before_after_indicator = NodaTimeBeforeAfterIndicator::none):NodaSplitTime {
$start_year = $end_year = $year;
$start_date = $end_date = $year . '-' . $month . '-' . $day;
if ($before_after_indicator === NodaTimeBeforeAfterIndicator::before
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::until) {
$start_year = $start_date = '?';
}
if ($before_after_indicator === NodaTimeBeforeAfterIndicator::after
|| $before_after_indicator === NodaTimeBeforeAfterIndicator::since) {
$end_year = $end_date = '?';
}
return new NodaSplitTime($start_year, $end_year, $month, $day, start_date: $start_date, end_date: $end_date);
}
/**
* Validates the entered start year.
*
* @param string $input Input to validate.
*
* @return void
*/
private function _validateStartYear(string $input):void {
if (strlen($input) > 6) {
throw new MDgenericInvalidInputsException("Time statement longer than 6 characters is impossible");
}
if (($this->before_after_indicator === NodaTimeBeforeAfterIndicator::before
|| $this->before_after_indicator === NodaTimeBeforeAfterIndicator::until)
&& $input !== '?'
) {
throw new MDgenericInvalidInputsException("Times with no certain start need to have a question mark (?) entered as a start date");
}
}
/**
* Validates the entered end year.
*
* @param string $input Input to validate.
*
* @return void
*/
private function _validateEndYear(string $input):void {
if (strlen($input) > 6) {
throw new MDgenericInvalidInputsException("Time statement longer than 6 characters is impossible");
}
if (($this->before_after_indicator === NodaTimeBeforeAfterIndicator::after
|| $this->before_after_indicator === NodaTimeBeforeAfterIndicator::since)
&& $input !== '?'
) {
throw new MDgenericInvalidInputsException("Times with no certain end need to have a question mark (?) entered as a end date");
}
}
/**
* Pads to four digits. E.g. 2 > 02.
*
* @param string $input Input string.
*
* @return string
*/
public static function pad_to_two(string $input):string {
return \substr("00" . $input, -2);
}
/**
* Validates the entered month string.
*
* @param string $input Input to validate.
*
* @return string
*/
private function _validateCountingTimeMonth(string $input):string {
if (strlen($input) > 2) throw new MDgenericInvalidInputsException("Input too long");
if ($input === '00') {
return $input;
}
if (($parsedInt = filter_var(ltrim($input, "0"), FILTER_VALIDATE_INT)) === false) {
throw new MDgenericInvalidInputsException("Input value is not numeric");
}
if ($parsedInt > 12) {
throw new MDgenericInvalidInputsException("Attempted to set a month number beyond 12");
}
return self::pad_to_two($input);
}
/**
* Validates the entered day string.
*
* @param string $input Input to validate.
*
* @return string
*/
private function _validateCountingTimeDay(string $input):string {
if (strlen($input) > 2) throw new MDgenericInvalidInputsException("Input too long");
if ($input === '00') {
return $input;
}
if (($parsedInt = filter_var(ltrim($input, "0"), FILTER_VALIDATE_INT)) === false) {
throw new MDgenericInvalidInputsException("Input value is not numeric");
}
if ($parsedInt > 31) {
throw new MDgenericInvalidInputsException("Attempted to set a day number beyond 31");
}
return self::pad_to_two($input);
}
/**
* Returns a date time for the start of the time.
*
* @return DateTime
*/
public function startToDateTime():DateTime {
if ($this->counting_time_indicator === NodaCountingTimeIndicator::bce) {
return new DateTime('-' . $this->start_date);
}
else {
return new DateTime($this->start_date);
}
}
/**
* Returns a date time for the end of the time.
*
* @return DateTime
*/
public function endToDateTime():DateTime {
if ($this->counting_time_indicator === NodaCountingTimeIndicator::bce) {
return new DateTime('-' . $this->end_date);
}
else {
return new DateTime($this->end_date);
}
}
/**
* Generates a time name based on the current entry.
*
* @return string
*/
public function toTimeName():string {
$prefix = $this->before_after_indicator->toString();
if (!empty($prefix)) $prefix .= ' ';
// Determine start and end for display
if ($this->start_year === '?') {
$start = (int)$this->end_year;
}
else $start = (int)$this->start_year;
if ($this->end_year === '?') {
$end = (int)$this->start_year;
}
else $end = (int)$this->end_year;
if ($this->before_after_indicator === NodaTimeBeforeAfterIndicator::before && $this->counting_time_month === '00') {
$start++;
$end++;
}
else if ($this->before_after_indicator === NodaTimeBeforeAfterIndicator::after && $this->counting_time_month === '00') {
$start--;
$end--;
}
// Determine suffix
if ($start < 0 && $end < 0) {
$suffix = " v. Chr.";
}
else if ($end < 1000) {
$suffix = " n. Chr.";
}
else $suffix = "";
$start = \abs($start);
$end = \abs($end);
if ($start !== $end) {
return "{$prefix}{$start}-{$end}{$suffix}";
}
// A single day of a given month of a given (single) year
else if (\intval($this->counting_time_month) !== 0 and \intval($this->counting_time_day) !== 0) {
return "{$prefix}{$this->counting_time_day}.{$this->counting_time_month}.{$start}{$suffix}";
}
// A single year
else if ($start === $end && trim((string)$this->counting_time_month, " 0") === "" && trim((string)$this->counting_time_day, " 0") === "") {
return "{$prefix}{$start}{$suffix}";
}
// Single month of a given year
else if ($start === $end && trim((string)$this->counting_time_month, " 0") !== "" && trim((string)$this->counting_time_day, " 0") === "") {
$fmt = new IntlDateFormatter(
'de-DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
null,
IntlDateFormatter::GREGORIAN,
'MMMM Y'
);
try {
return $prefix . $fmt->format(MD_STD::strtotime("{$start}-{$this->counting_time_month}-15 01:01:01")) . $suffix;
}
catch (MDInvalidInputDate $e) {
return "";
}
}
return "";
}
/**
* Returns an array in the old time splitter format (array with sex values).
*
* @return array<string>
*/
public function toOldFormat():array {
return [
$this->start_year,
$this->end_year,
$this->counting_time_month,
$this->counting_time_day,
$this->counting_time_indicator->toString(),
$this->before_after_indicator->toString(),
];
}
/**
* Constructor.
*
* @return void
*/
public function __construct(string $start_year, string $end_year,
string $counting_time_month = "00", string $counting_time_day = "00",
NodaCountingTimeIndicator $counting_time_indicator = NodaCountingTimeIndicator::ce,
NodaTimeBeforeAfterIndicator $before_after_indicator = NodaTimeBeforeAfterIndicator::none,
false|string $start_date = false,
false|string $end_date = false,
) {
$this->counting_time_indicator = $counting_time_indicator;
$this->before_after_indicator = $before_after_indicator;
$this->_validateStartYear($start_year);
$this->start_year = $start_year;
$this->_validateEndYear($end_year);
$this->end_year = $end_year;
$this->counting_time_month = $this->_validateCountingTimeMonth($counting_time_month);
$this->counting_time_day = $this->_validateCountingTimeDay($counting_time_day);
// Calculate start date and end date
if (($this->before_after_indicator === NodaTimeBeforeAfterIndicator::before
|| $this->before_after_indicator === NodaTimeBeforeAfterIndicator::until)
) {
$this->start_date = '-9999-12-31';
}
if (($this->before_after_indicator === NodaTimeBeforeAfterIndicator::after
|| $this->before_after_indicator === NodaTimeBeforeAfterIndicator::since)
) {
$this->end_date = '9999-12-31';
}
if (!isset($this->start_date) && false !== $start_date) {
$this->start_date = date("Y-m-d", MD_STD::strtotime($start_date));
}
if (!isset($this->end_date) && false !== $end_date) {
$this->end_date = date("Y-m-d", MD_STD::strtotime($end_date));
}
if (!isset($this->start_date)) {
if ($this->counting_time_month === "00") {
$this->start_date = $this->start_year . '-01-01';
}
else if ($this->counting_time_day === "00") {
$this->start_date = $this->start_year . '-' . $this->counting_time_month . '-01';
}
else {
throw new MDgenericInvalidInputsException("Cannot identify start date automatically");
}
}
if (!isset($this->end_date)) {
if ($this->counting_time_month === "00") {
$this->end_date = $this->end_year . '-12-31';
}
else if ($this->counting_time_day === "00") {
$this->end_date = $this->end_year . '-' . $this->counting_time_month . '-31';
}
else {
throw new MDgenericInvalidInputsException("Cannot identify end date automatically");
}
}
}
}

View File

@ -480,12 +480,12 @@ final class NodaTimeAutotranslater {
} }
$startTimeInfo = [ $startTimeInfo = [
"zeit_name" => $timespanDates['start_name'], "zeit_name" => $timespanDates['start_name'],
"zeit_beginn" => $start[0], "zeit_beginn" => $start->start_year,
"zeit_ende" => $start[1], "zeit_ende" => $start->end_year,
"zeit_zaehlzeit_jahr" => NodaTimeSplitter::timePartsToCountingYear($start), "zeit_zaehlzeit_jahr" => NodaTimeSplitter::timePartsToCountingYear($start),
"zeit_zaehlzeit_monat" => $start[2], "zeit_zaehlzeit_monat" => $start->counting_time_month,
"zeit_zaehlzeit_tag" => $start[3], "zeit_zaehlzeit_tag" => $start->counting_time_day,
"zeit_zaehlzeit_vorzeichen" => $start[4], "zeit_zaehlzeit_vorzeichen" => $start->counting_time_indicator->toString(),
]; ];
if (empty($end = NodaTimeSplitter::attempt_splitting($timespanDates['end_name']))) { if (empty($end = NodaTimeSplitter::attempt_splitting($timespanDates['end_name']))) {
@ -493,12 +493,12 @@ final class NodaTimeAutotranslater {
} }
$endTimeInfo = [ $endTimeInfo = [
"zeit_name" => $timespanDates['end_name'], "zeit_name" => $timespanDates['end_name'],
"zeit_beginn" => $end[0], "zeit_beginn" => $end->start_year,
"zeit_ende" => $end[1], "zeit_ende" => $end->end_year,
"zeit_zaehlzeit_jahr" => NodaTimeSplitter::timePartsToCountingYear($end), "zeit_zaehlzeit_jahr" => NodaTimeSplitter::timePartsToCountingYear($end),
"zeit_zaehlzeit_monat" => $end[2], "zeit_zaehlzeit_monat" => $end->counting_time_month,
"zeit_zaehlzeit_tag" => $end[3], "zeit_zaehlzeit_tag" => $end->counting_time_day,
"zeit_zaehlzeit_vorzeichen" => $end[4], "zeit_zaehlzeit_vorzeichen" => $end->counting_time_indicator->toString(),
]; ];
$output = []; $output = [];

View File

@ -0,0 +1,67 @@
<?PHP
/**
* Represents a time indicator (CE / BCE).
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a time indicator (CE / BCE).
*/
enum NodaTimeBeforeAfterIndicator implements JsonSerializable {
case none;
case after;
case before;
case since;
case until;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return NodaTimeBeforeAfterIndicator
*/
public static function fromString(string $input):NodaTimeBeforeAfterIndicator {
return match($input) {
'' => self::none,
'Nach' => self::after,
'Vor' => self::before,
'Seit' => self::since,
'Bis' => self::until,
default => throw new MDpageParameterNotFromListException("Unknown before / after indicator"),
};
}
/**
* Returns a canonical string representation.
*
* @return string
*/
public function toString():string {
return match($this) {
self::none => '',
self::after => 'Nach',
self::before => 'Vor',
self::since => 'Seit',
self::until => 'Bis',
};
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,23 @@ final class NodaTimeSplitterTest extends TestCase {
*/ */
public function testSplitSimpleDatesGerman():void { public function testSplitSimpleDatesGerman():void {
$output = NodaTimeSplitter::attempt_splitting("2. Januar 2020");
self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020",
1 => "2020",
2 => "01",
3 => "02",
4 => "+",
5 => "",
]);
self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("02.1.25 v. Chr"); $output = NodaTimeSplitter::attempt_splitting("02.1.25 v. Chr");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-25", 0 => "-25",
1 => "-25", 1 => "-25",
2 => "01", 2 => "01",
@ -33,11 +48,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.25 v. Chr."); self::assertEquals($output->toTimeName(), "02.01.25 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25);
$output = NodaTimeSplitter::attempt_splitting("2.01.25 v. Chr"); $output = NodaTimeSplitter::attempt_splitting("2.01.25 v. Chr");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-25", 0 => "-25",
1 => "-25", 1 => "-25",
2 => "01", 2 => "01",
@ -45,11 +61,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.25 v. Chr."); self::assertEquals($output->toTimeName(), "02.01.25 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25);
$output = NodaTimeSplitter::attempt_splitting("02.01.25 v. Chr"); $output = NodaTimeSplitter::attempt_splitting("02.01.25 v. Chr");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-25", 0 => "-25",
1 => "-25", 1 => "-25",
2 => "01", 2 => "01",
@ -57,11 +74,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.25 v. Chr."); self::assertEquals($output->toTimeName(), "02.01.25 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25);
$output = NodaTimeSplitter::attempt_splitting("2.1.25 v. Chr"); $output = NodaTimeSplitter::attempt_splitting("2.1.25 v. Chr");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-25", 0 => "-25",
1 => "-25", 1 => "-25",
2 => "01", 2 => "01",
@ -69,11 +87,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.25 v. Chr."); self::assertEquals($output->toTimeName(), "02.01.25 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 25);
$output = NodaTimeSplitter::attempt_splitting("2.1.2020"); $output = NodaTimeSplitter::attempt_splitting("2.1.2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -81,11 +100,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020"); self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("02.01.2020"); $output = NodaTimeSplitter::attempt_splitting("02.01.2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -93,23 +113,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020"); self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("2. Januar 2020");
self::assertEquals($output, [
0 => "2020",
1 => "2020",
2 => "01",
3 => "02",
4 => "+",
5 => "",
]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("1920-1929"); $output = NodaTimeSplitter::attempt_splitting("1920-1929");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
@ -117,11 +126,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1920-1929"); self::assertEquals($output->toTimeName(), "1920-1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
$output = NodaTimeSplitter::attempt_splitting("20er"); $output = NodaTimeSplitter::attempt_splitting("20er");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
@ -129,11 +139,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1920-1929"); self::assertEquals($output->toTimeName(), "1920-1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
$output = NodaTimeSplitter::attempt_splitting("1920-1929"); $output = NodaTimeSplitter::attempt_splitting("1920-1929");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
@ -141,11 +152,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1920-1929"); self::assertEquals($output->toTimeName(), "1920-1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
$output = NodaTimeSplitter::attempt_splitting("1920er Jahre"); $output = NodaTimeSplitter::attempt_splitting("1920er Jahre");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
@ -153,11 +165,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1920-1929"); self::assertEquals($output->toTimeName(), "1920-1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
$output = NodaTimeSplitter::attempt_splitting("Vor Dezember 2020"); $output = NodaTimeSplitter::attempt_splitting("Vor Dezember 2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "2020", 1 => "2020",
2 => "12", 2 => "12",
@ -165,11 +178,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "Vor", 5 => "Vor",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Vor Dezember 2020"); self::assertEquals($output->toTimeName(), "Vor Dezember 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("Vor 2020"); $output = NodaTimeSplitter::attempt_splitting("Vor 2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "2019", 1 => "2019",
2 => "00", 2 => "00",
@ -177,11 +191,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "Vor", 5 => "Vor",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Vor 2020"); self::assertEquals($output->toTimeName(), "Vor 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("Nach Januar 2020"); $output = NodaTimeSplitter::attempt_splitting("Nach Januar 2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "?", 1 => "?",
2 => "01", 2 => "01",
@ -189,11 +204,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "Nach", 5 => "Nach",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Nach Januar 2020"); self::assertEquals($output->toTimeName(), "Nach Januar 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("Januar 2020"); $output = NodaTimeSplitter::attempt_splitting("Januar 2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -201,11 +217,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 2020"); self::assertEquals($output->toTimeName(), "Januar 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("Januar 1217"); $output = NodaTimeSplitter::attempt_splitting("Januar 1217");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1217", 0 => "1217",
1 => "1217", 1 => "1217",
2 => "01", 2 => "01",
@ -214,11 +231,12 @@ final class NodaTimeSplitterTest extends TestCase {
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 1217"); self::assertEquals($output->toTimeName(), "Januar 1217");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1217); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1217);
$output = NodaTimeSplitter::attempt_splitting("Januar 1520"); $output = NodaTimeSplitter::attempt_splitting("Januar 1520");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1520", 0 => "1520",
1 => "1520", 1 => "1520",
2 => "01", 2 => "01",
@ -227,11 +245,12 @@ final class NodaTimeSplitterTest extends TestCase {
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 1520"); self::assertEquals($output->toTimeName(), "Januar 1520");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1520); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1520);
$output = NodaTimeSplitter::attempt_splitting("Januar 1001"); $output = NodaTimeSplitter::attempt_splitting("Januar 1001");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1001", 0 => "1001",
1 => "1001", 1 => "1001",
2 => "01", 2 => "01",
@ -240,11 +259,12 @@ final class NodaTimeSplitterTest extends TestCase {
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 1001"); self::assertEquals($output->toTimeName(), "Januar 1001");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1001); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1001);
$output = NodaTimeSplitter::attempt_splitting("Januar 2780"); $output = NodaTimeSplitter::attempt_splitting("Januar 2780");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2780", 0 => "2780",
1 => "2780", 1 => "2780",
2 => "01", 2 => "01",
@ -253,11 +273,12 @@ final class NodaTimeSplitterTest extends TestCase {
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 2780"); self::assertEquals($output->toTimeName(), "Januar 2780");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2780); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2780);
$output = NodaTimeSplitter::attempt_splitting("Nach 60er Jahre"); $output = NodaTimeSplitter::attempt_splitting("Nach 60er Jahre");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1970", 0 => "1970",
1 => "?", 1 => "?",
2 => "00", 2 => "00",
@ -265,11 +286,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "Nach", 5 => "Nach",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Nach 1969"); self::assertEquals($output->toTimeName(), "Nach 1969");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1969); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1969);
$output = NodaTimeSplitter::attempt_splitting("Nach 2020"); $output = NodaTimeSplitter::attempt_splitting("Nach 2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2021", 0 => "2021",
1 => "?", 1 => "?",
2 => "00", 2 => "00",
@ -277,23 +299,25 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "Nach", 5 => "Nach",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Nach 2020"); self::assertEquals($output->toTimeName(), "Nach 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("Bis Januar 2020"); $output = NodaTimeSplitter::attempt_splitting("Bis Januar 2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
3 => "00", 3 => "00",
4 => "+", 4 => "+",
5 => "", 5 => "Bis",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Bis Januar 2020"); self::assertEquals($output->toTimeName(), "Bis Januar 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("Januar 2020"); $output = NodaTimeSplitter::attempt_splitting("Januar 2020");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -301,12 +325,13 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 2020"); self::assertEquals($output->toTimeName(), "Januar 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
// Intl' month: 2020-01 // Intl' month: 2020-01
$output = NodaTimeSplitter::attempt_splitting("2020-01"); $output = NodaTimeSplitter::attempt_splitting("2020-01");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -314,11 +339,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 2020"); self::assertEquals($output->toTimeName(), "Januar 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("Januar 2020 v. Chr."); $output = NodaTimeSplitter::attempt_splitting("Januar 2020 v. Chr.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-2020", 0 => "-2020",
1 => "-2020", 1 => "-2020",
2 => "01", 2 => "01",
@ -326,12 +352,13 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 2020 v. Chr."); self::assertEquals($output->toTimeName(), "Januar 2020 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
// 5-Digit timespans BCE // 5-Digit timespans BCE
$output = NodaTimeSplitter::attempt_splitting("40000-25000 vor Christus"); $output = NodaTimeSplitter::attempt_splitting("40000-25000 vor Christus");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-40000", 0 => "-40000",
1 => "-25000", 1 => "-25000",
2 => "00", 2 => "00",
@ -339,12 +366,13 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "40000-25000 v. Chr."); self::assertEquals($output->toTimeName(), "40000-25000 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 32500); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 32500);
// 5-Digit timespans BCE // 5-Digit timespans BCE
$output = NodaTimeSplitter::attempt_splitting("40000-25000 v.C."); $output = NodaTimeSplitter::attempt_splitting("40000-25000 v.C.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-40000", 0 => "-40000",
1 => "-25000", 1 => "-25000",
2 => "00", 2 => "00",
@ -352,11 +380,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "40000-25000 v. Chr."); self::assertEquals($output->toTimeName(), "40000-25000 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 32500); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 32500);
$output = NodaTimeSplitter::attempt_splitting("20. Jahrhundert v. Chr."); $output = NodaTimeSplitter::attempt_splitting("20. Jahrhundert v. Chr.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-2000", 0 => "-2000",
1 => "-1901", 1 => "-1901",
2 => "00", 2 => "00",
@ -364,11 +393,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "2000-1901 v. Chr."); self::assertEquals($output->toTimeName(), "2000-1901 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1950); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1950);
$output = NodaTimeSplitter::attempt_splitting("20. Jh."); $output = NodaTimeSplitter::attempt_splitting("20. Jh.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1901", 0 => "1901",
1 => "2000", 1 => "2000",
2 => "00", 2 => "00",
@ -376,11 +406,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1901-2000"); self::assertEquals($output->toTimeName(), "1901-2000");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951);
$output = NodaTimeSplitter::attempt_splitting("20. Jhd."); $output = NodaTimeSplitter::attempt_splitting("20. Jhd.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1901", 0 => "1901",
1 => "2000", 1 => "2000",
2 => "00", 2 => "00",
@ -388,11 +419,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1901-2000"); self::assertEquals($output->toTimeName(), "1901-2000");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951);
$output = NodaTimeSplitter::attempt_splitting("20. Jhdt."); $output = NodaTimeSplitter::attempt_splitting("20. Jhdt.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1901", 0 => "1901",
1 => "2000", 1 => "2000",
2 => "00", 2 => "00",
@ -400,11 +432,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1901-2000"); self::assertEquals($output->toTimeName(), "1901-2000");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951);
$output = NodaTimeSplitter::attempt_splitting("20. Jahrhundert"); $output = NodaTimeSplitter::attempt_splitting("20. Jahrhundert");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1901", 0 => "1901",
1 => "2000", 1 => "2000",
2 => "00", 2 => "00",
@ -412,11 +445,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1901-2000"); self::assertEquals($output->toTimeName(), "1901-2000");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951);
$output = NodaTimeSplitter::attempt_splitting("20.-19. Jahrhundert v. Chr."); $output = NodaTimeSplitter::attempt_splitting("20.-19. Jahrhundert v. Chr.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-2000", 0 => "-2000",
1 => "-1801", 1 => "-1801",
2 => "00", 2 => "00",
@ -424,23 +458,25 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "2000-1801 v. Chr."); self::assertEquals($output->toTimeName(), "2000-1801 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1900); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1900);
$output = NodaTimeSplitter::attempt_splitting("Bis 20.-19. Jahrhundert v. Chr."); $output = NodaTimeSplitter::attempt_splitting("Bis 20.-19. Jahrhundert v. Chr.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "-1801", 1 => "-1801",
2 => "00", 2 => "00",
3 => "00", 3 => "00",
4 => "-", 4 => "-",
5 => "", 5 => "Bis",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Bis 1801 v. Chr."); self::assertEquals($output->toTimeName(), "Bis 1801 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1801); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1801);
$output = NodaTimeSplitter::attempt_splitting("6 November 1978"); $output = NodaTimeSplitter::attempt_splitting("6 November 1978");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1978", 0 => "1978",
1 => "1978", 1 => "1978",
2 => "11", 2 => "11",
@ -448,7 +484,7 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "06.11.1978"); self::assertEquals($output->toTimeName(), "06.11.1978");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1978); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1978);
} }
@ -465,7 +501,8 @@ final class NodaTimeSplitterTest extends TestCase {
public function testSplitSimpleDatesEnglish():void { public function testSplitSimpleDatesEnglish():void {
$output = NodaTimeSplitter::attempt_splitting("1925 BCE"); $output = NodaTimeSplitter::attempt_splitting("1925 BCE");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-1925", 0 => "-1925",
1 => "-1925", 1 => "-1925",
2 => "00", 2 => "00",
@ -473,11 +510,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1925 v. Chr."); self::assertEquals($output->toTimeName(), "1925 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
$output = NodaTimeSplitter::attempt_splitting("1925 CE"); $output = NodaTimeSplitter::attempt_splitting("1925 CE");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1925", 0 => "1925",
1 => "1925", 1 => "1925",
2 => "00", 2 => "00",
@ -485,7 +523,7 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1925"); self::assertEquals($output->toTimeName(), "1925");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
} }
@ -502,7 +540,8 @@ final class NodaTimeSplitterTest extends TestCase {
public function testSplitSimpleDatesHungarian():void { public function testSplitSimpleDatesHungarian():void {
$output = NodaTimeSplitter::attempt_splitting("2020.01.02."); $output = NodaTimeSplitter::attempt_splitting("2020.01.02.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -510,11 +549,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020"); self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("2020. januar. 2."); $output = NodaTimeSplitter::attempt_splitting("2020. januar. 2.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -522,11 +562,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020"); self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("2020.01.2."); $output = NodaTimeSplitter::attempt_splitting("2020.01.2.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -534,11 +575,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020"); self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("2020.1.2."); $output = NodaTimeSplitter::attempt_splitting("2020.1.2.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -546,11 +588,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020"); self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("2020. Januar 2."); $output = NodaTimeSplitter::attempt_splitting("2020. Januar 2.");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -558,11 +601,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020"); self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("2020-01-02"); $output = NodaTimeSplitter::attempt_splitting("2020-01-02");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "01", 2 => "01",
@ -570,11 +614,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "02.01.2020"); self::assertEquals($output->toTimeName(), "02.01.2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("1920-tól 1929-ig"); $output = NodaTimeSplitter::attempt_splitting("1920-tól 1929-ig");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
@ -582,11 +627,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1920-1929"); self::assertEquals($output->toTimeName(), "1920-1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
$output = NodaTimeSplitter::attempt_splitting("1920-1929 között"); $output = NodaTimeSplitter::attempt_splitting("1920-1929 között");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
@ -594,11 +640,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1920-1929"); self::assertEquals($output->toTimeName(), "1920-1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
$output = NodaTimeSplitter::attempt_splitting("1920-től 1929-ig"); $output = NodaTimeSplitter::attempt_splitting("1920-től 1929-ig");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
@ -606,24 +653,26 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1920-1929"); self::assertEquals($output->toTimeName(), "1920-1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
// From 1920 onwards // From 1920 onwards
$output = NodaTimeSplitter::attempt_splitting("1920 utántól"); $output = NodaTimeSplitter::attempt_splitting("1920 utántól");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "?", 1 => "?",
2 => "00", 2 => "00",
3 => "00", 3 => "00",
4 => "+", 4 => "+",
5 => "", 5 => "Seit",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Seit 1920"); self::assertEquals($output->toTimeName(), "Seit 1920");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1920); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1920);
$output = NodaTimeSplitter::attempt_splitting("1920-es évek"); $output = NodaTimeSplitter::attempt_splitting("1920-es évek");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1920", 0 => "1920",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
@ -631,22 +680,24 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1920-1929"); self::assertEquals($output->toTimeName(), "1920-1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1925);
$output = NodaTimeSplitter::attempt_splitting("1920-es évekig"); $output = NodaTimeSplitter::attempt_splitting("1920-es évekig");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "1929", 1 => "1929",
2 => "00", 2 => "00",
3 => "00", 3 => "00",
4 => "+", 4 => "+",
5 => "", 5 => "Bis",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Bis 1929"); self::assertEquals($output->toTimeName(), "Bis 1929");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1929); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1929);
$output = NodaTimeSplitter::attempt_splitting("2020. Januar"); $output = NodaTimeSplitter::attempt_splitting("2020. Januar");
self::assertNotEmpty($output);
self::assertEquals([ self::assertEquals([
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
@ -654,12 +705,13 @@ final class NodaTimeSplitterTest extends TestCase {
3 => "00", 3 => "00",
4 => "+", 4 => "+",
5 => "", 5 => "",
], $output); ], $output->toOldFormat());
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 2020"); self::assertEquals($output->toTimeName(), "Januar 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("Kr. e. 2020. Januar"); $output = NodaTimeSplitter::attempt_splitting("Kr. e. 2020. Januar");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-2020", 0 => "-2020",
1 => "-2020", 1 => "-2020",
2 => "01", 2 => "01",
@ -667,11 +719,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 2020 v. Chr."); self::assertEquals($output->toTimeName(), "Januar 2020 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
$output = NodaTimeSplitter::attempt_splitting("20. sz"); $output = NodaTimeSplitter::attempt_splitting("20. sz");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1901", 0 => "1901",
1 => "2000", 1 => "2000",
2 => "00", 2 => "00",
@ -679,11 +732,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1901-2000"); self::assertEquals($output->toTimeName(), "1901-2000");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951);
$output = NodaTimeSplitter::attempt_splitting("III. század"); $output = NodaTimeSplitter::attempt_splitting("III. század");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "201", 0 => "201",
1 => "300", 1 => "300",
2 => "00", 2 => "00",
@ -691,11 +745,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "201-300 n. Chr."); self::assertEquals($output->toTimeName(), "201-300 n. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 251); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 251);
$output = NodaTimeSplitter::attempt_splitting("20th century"); $output = NodaTimeSplitter::attempt_splitting("20th century");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1901", 0 => "1901",
1 => "2000", 1 => "2000",
2 => "00", 2 => "00",
@ -703,11 +758,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1901-2000"); self::assertEquals($output->toTimeName(), "1901-2000");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951);
$output = NodaTimeSplitter::attempt_splitting("20. század"); $output = NodaTimeSplitter::attempt_splitting("20. század");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1901", 0 => "1901",
1 => "2000", 1 => "2000",
2 => "00", 2 => "00",
@ -715,11 +771,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1901-2000"); self::assertEquals($output->toTimeName(), "1901-2000");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951);
$output = NodaTimeSplitter::attempt_splitting("20.század"); $output = NodaTimeSplitter::attempt_splitting("20.század");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "1901", 0 => "1901",
1 => "2000", 1 => "2000",
2 => "00", 2 => "00",
@ -727,11 +784,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "1901-2000"); self::assertEquals($output->toTimeName(), "1901-2000");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1951);
$output = NodaTimeSplitter::attempt_splitting("Kr. e. 20. század"); $output = NodaTimeSplitter::attempt_splitting("Kr. e. 20. század");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-2000", 0 => "-2000",
1 => "-1901", 1 => "-1901",
2 => "00", 2 => "00",
@ -739,11 +797,12 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "2000-1901 v. Chr."); self::assertEquals($output->toTimeName(), "2000-1901 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1950); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1950);
$output = NodaTimeSplitter::attempt_splitting("Kr. e. 20.-19. század"); $output = NodaTimeSplitter::attempt_splitting("Kr. e. 20.-19. század");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "-2000", 0 => "-2000",
1 => "-1801", 1 => "-1801",
2 => "00", 2 => "00",
@ -751,25 +810,27 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "-", 4 => "-",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "2000-1801 v. Chr."); self::assertEquals($output->toTimeName(), "2000-1801 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1900); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1900);
$output = NodaTimeSplitter::attempt_splitting("Kr. e. 20.-19. század-ig"); $output = NodaTimeSplitter::attempt_splitting("Kr. e. 20.-19. század-ig");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "-1801", 1 => "-1801",
2 => "00", 2 => "00",
3 => "00", 3 => "00",
4 => "-", 4 => "-",
5 => "", 5 => "Bis",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Bis 1801 v. Chr."); self::assertEquals($output->toTimeName(), "Bis 1801 v. Chr.");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1801); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1801);
/* /*
* TODO * TODO
$output = NodaTimeSplitter::attempt_splitting("1900 előtt"); $output = NodaTimeSplitter::attempt_splitting("1900 előtt");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "1899", 1 => "1899",
2 => "00", 2 => "00",
@ -777,36 +838,39 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Vor 1900"); self::assertEquals($output->toTimeName(), "Vor 1900");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1899); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1899);
*/ */
$output = NodaTimeSplitter::attempt_splitting("1900-ig"); $output = NodaTimeSplitter::attempt_splitting("1900-ig");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "1900", 1 => "1900",
2 => "00", 2 => "00",
3 => "00", 3 => "00",
4 => "+", 4 => "+",
5 => "", 5 => "Bis",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Bis 1900"); self::assertEquals($output->toTimeName(), "Bis 1900");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1900); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1900);
$output = NodaTimeSplitter::attempt_splitting("1900ig"); $output = NodaTimeSplitter::attempt_splitting("1900ig");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "1900", 1 => "1900",
2 => "00", 2 => "00",
3 => "00", 3 => "00",
4 => "+", 4 => "+",
5 => "", 5 => "Bis",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Bis 1900"); self::assertEquals($output->toTimeName(), "Bis 1900");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1900); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1900);
$output = NodaTimeSplitter::attempt_splitting("2020. december előtt"); $output = NodaTimeSplitter::attempt_splitting("2020. december előtt");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "?", 0 => "?",
1 => "2020", 1 => "2020",
2 => "12", 2 => "12",
@ -814,7 +878,7 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "Vor", 5 => "Vor",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Vor Dezember 2020"); self::assertEquals($output->toTimeName(), "Vor Dezember 2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
} }
@ -831,7 +895,8 @@ final class NodaTimeSplitterTest extends TestCase {
public function testSplitSimpleDatesUkrainian():void { public function testSplitSimpleDatesUkrainian():void {
$output = NodaTimeSplitter::attempt_splitting("2020 p"); $output = NodaTimeSplitter::attempt_splitting("2020 p");
self::assertEquals($output, [ self::assertNotEmpty($output);
self::assertEquals($output->toOldFormat(), [
0 => "2020", 0 => "2020",
1 => "2020", 1 => "2020",
2 => "00", 2 => "00",
@ -839,7 +904,7 @@ final class NodaTimeSplitterTest extends TestCase {
4 => "+", 4 => "+",
5 => "", 5 => "",
]); ]);
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "2020"); self::assertEquals($output->toTimeName(), "2020");
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020); self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 2020);
} }
@ -864,8 +929,8 @@ final class NodaTimeSplitterTest extends TestCase {
"start_year" => '2004', "start_year" => '2004',
"end_year" => '2004', "end_year" => '2004',
"counting_time_year" => "2004", "counting_time_year" => "2004",
"counting_time_month" => "01", "counting_time_month" => "02",
"counting_time_day" => "16", "counting_time_day" => "01",
"counting_time_bcce" => "+", "counting_time_bcce" => "+",
]); ]);
@ -878,8 +943,8 @@ final class NodaTimeSplitterTest extends TestCase {
"start_year" => '2004', "start_year" => '2004',
"end_year" => '2004', "end_year" => '2004',
"counting_time_year" => "2004", "counting_time_year" => "2004",
"counting_time_month" => "01", "counting_time_month" => "02",
"counting_time_day" => "16", "counting_time_day" => "01",
"counting_time_bcce" => "+", "counting_time_bcce" => "+",
]); ]);
@ -925,8 +990,8 @@ final class NodaTimeSplitterTest extends TestCase {
'end_name' => "1900", 'end_name' => "1900",
"start_year" => '1601', "start_year" => '1601',
"end_year" => '1900', "end_year" => '1900',
"counting_time_year" => "1750", "counting_time_year" => "1751",
"counting_time_month" => "06", "counting_time_month" => "01",
"counting_time_day" => "01", "counting_time_day" => "01",
"counting_time_bcce" => "+", "counting_time_bcce" => "+",
]); ]);
@ -939,8 +1004,8 @@ final class NodaTimeSplitterTest extends TestCase {
'end_name' => "1969", 'end_name' => "1969",
"start_year" => '1950', "start_year" => '1950',
"end_year" => '1969', "end_year" => '1969',
"counting_time_year" => "1959", "counting_time_year" => "1960",
"counting_time_month" => "06", "counting_time_month" => "01",
"counting_time_day" => "01", "counting_time_day" => "01",
"counting_time_bcce" => "+", "counting_time_bcce" => "+",
]); ]);