Fix bug in setting names for months
This commit is contained in:
parent
d641b64630
commit
511304b6f2
|
@ -266,7 +266,7 @@ final class NodaTimeSplitter {
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $prefix . $fmt->format(MD_STD::strtotime("{$moda[0]}-{$moda[2]}-10 01:01:01")) . $suffix;
|
return $prefix . $fmt->format(MD_STD::strtotime("{$moda[0]}-{$moda[2]}-15 01:01:01")) . $suffix;
|
||||||
}
|
}
|
||||||
catch (MDInvalidInputDate $e) {
|
catch (MDInvalidInputDate $e) {
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -201,9 +201,49 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||||
4 => "+",
|
4 => "+",
|
||||||
5 => "",
|
5 => "",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 1217");
|
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 1217");
|
||||||
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1217);
|
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1217);
|
||||||
|
|
||||||
|
$output = NodaTimeSplitter::attempt_splitting("Januar 1520");
|
||||||
|
self::assertEquals($output, [
|
||||||
|
0 => "1520",
|
||||||
|
1 => "1520",
|
||||||
|
2 => "01",
|
||||||
|
3 => "00",
|
||||||
|
4 => "+",
|
||||||
|
5 => "",
|
||||||
|
]);
|
||||||
|
|
||||||
|
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 1520");
|
||||||
|
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1520);
|
||||||
|
|
||||||
|
$output = NodaTimeSplitter::attempt_splitting("Januar 1001");
|
||||||
|
self::assertEquals($output, [
|
||||||
|
0 => "1001",
|
||||||
|
1 => "1001",
|
||||||
|
2 => "01",
|
||||||
|
3 => "00",
|
||||||
|
4 => "+",
|
||||||
|
5 => "",
|
||||||
|
]);
|
||||||
|
|
||||||
|
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 1001");
|
||||||
|
self::assertEquals(NodaTimeSplitter::timePartsToCountingYear($output), 1001);
|
||||||
|
|
||||||
|
$output = NodaTimeSplitter::attempt_splitting("Januar 2780");
|
||||||
|
self::assertEquals($output, [
|
||||||
|
0 => "2780",
|
||||||
|
1 => "2780",
|
||||||
|
2 => "01",
|
||||||
|
3 => "00",
|
||||||
|
4 => "+",
|
||||||
|
5 => "",
|
||||||
|
]);
|
||||||
|
|
||||||
|
self::assertEquals(NodaTimeSplitter::timePartsToTimeName($output), "Januar 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::assertEquals($output, [
|
||||||
0 => "1970",
|
0 => "1970",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user