Fix broken time splitting for year ranges BC

This commit is contained in:
2024-05-04 01:17:33 +02:00
parent eb14615917
commit 7d303e219f
3 changed files with 23 additions and 1 deletions

View File

@ -336,13 +336,17 @@ final class NodaTimeSplitter {
$start = \strval(-1 * \intval($output->end_year));
$end = \strval(-1 * \intval($output->start_year));
$start_date = $output->end_date;
$end_date = $output->start_date;
if (\intval($start) > \intval($end)) {
$startToSet = $end;
$end = $start;
$start = $startToSet;
$start_date = $output->start_date;
$end_date = $output->end_date;
}
return new NodaSplitTime($start, $end, $output->counting_time_month, $output->counting_time_day,
NodaCountingTimeIndicator::bce, $output->before_after_indicator, '-' . $output->end_date, '-' . $output->start_date);
NodaCountingTimeIndicator::bce, $output->before_after_indicator, '-' . $start_date, '-' . $end_date);
}
}