Stop time splitter for start / end, if common time splitter can be used
This commit is contained in:
parent
c02165df7b
commit
a761a9dfd7
|
@ -997,6 +997,10 @@ final class NodaTimeSplitter {
|
||||||
*/
|
*/
|
||||||
public static function attempt_splitting_from_till(string $datum):array {
|
public static function attempt_splitting_from_till(string $datum):array {
|
||||||
|
|
||||||
|
// Skip 1200-1300
|
||||||
|
if (!empty(self::attempt_splitting($datum))) return [];
|
||||||
|
if (strlen($datum) === 9 and substr($datum, 4, 1)) return [];
|
||||||
|
|
||||||
if (empty($startEnd = self::check_is_timespan_from_till($datum))) {
|
if (empty($startEnd = self::check_is_timespan_from_till($datum))) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -1020,9 +1024,15 @@ final class NodaTimeSplitter {
|
||||||
$middle_day = date('Y-m-d',
|
$middle_day = date('Y-m-d',
|
||||||
strtotime('+' . $middle_substraction . ' days', strtotime($startDate->format('Y-m-d'))));
|
strtotime('+' . $middle_substraction . ' days', strtotime($startDate->format('Y-m-d'))));
|
||||||
|
|
||||||
|
$start_name = self::timePartsToTimeName($start);
|
||||||
|
$end_name = self::timePartsToTimeName($end);
|
||||||
|
|
||||||
|
if (strlen($start_name) === 9 and substr($start_name, 4, 1) === '-') $start_name = substr($start_name, 0, 4);
|
||||||
|
if (strlen($end_name) === 9 and substr($end_name, 4, 1) === '-') $end_name = substr($end_name, 5, 4);
|
||||||
|
|
||||||
$output = [
|
$output = [
|
||||||
"start_name" => self::timePartsToTimeName($start),
|
"start_name" => $start_name,
|
||||||
"end_name" => self::timePartsToTimeName($end),
|
"end_name" => $end_name,
|
||||||
"start_year" => $start[0],
|
"start_year" => $start[0],
|
||||||
"end_year" => $end[1],
|
"end_year" => $end[1],
|
||||||
"counting_time_year" => substr($middle_day, 0, 4),
|
"counting_time_year" => substr($middle_day, 0, 4),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user