parent
8491b62a83
commit
e8edb4a459
@ -1101,6 +1101,15 @@ final class NodaTimeSplitter {
|
||||
|
||||
if (empty($datum)) return '';
|
||||
|
||||
if (\preg_match("/^1\.\ (Halbjahr|Hälfte)\ [0-9]{4}$/", $datum)) {
|
||||
$year = substr($datum, -4);
|
||||
return "Januar $year-Juni $year";
|
||||
}
|
||||
if (\preg_match("/^2\.\ (Halbjahr|Hälfte)\ [0-9]{4}$/", $datum)) {
|
||||
$year = substr($datum, -4);
|
||||
return "Juli $year-Dezember $year";
|
||||
}
|
||||
|
||||
$inputLength = strlen($datum);
|
||||
|
||||
// Hungarian year and month until month
|
||||
|
@ -6,12 +6,14 @@
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\Small;
|
||||
|
||||
/**
|
||||
* This script contains tests for the actor name splitter.
|
||||
*
|
||||
* @covers \NodaNameSplitter
|
||||
*/
|
||||
#[Small]
|
||||
#[CoversClass(\NodaIDGetter::class)]
|
||||
final class NodaNameSplitterTest extends TestCase {
|
||||
/**
|
||||
* Test to check whether the HTML page is correctly generated.
|
||||
|
@ -509,6 +509,18 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||
"counting_time_day" => "01",
|
||||
"counting_time_bcce" => "+",
|
||||
],
|
||||
"1. Halbjahr 1950" => [
|
||||
'start_name' => "Januar 1950",
|
||||
'end_name' => "Juni 1950",
|
||||
"start_year" => '1950',
|
||||
"end_year" => '1950',
|
||||
'start_date' => '1950-01-01',
|
||||
'end_date' => '1950-06-31',
|
||||
"counting_time_year" => "1950",
|
||||
"counting_time_month" => "04",
|
||||
"counting_time_day" => "02",
|
||||
"counting_time_bcce" => "+",
|
||||
],
|
||||
] as $in => $out) {
|
||||
$output[$in] = [$in, $out];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user