Remove deprecated strfttime in NodaTimeSplitter

This commit is contained in:
Joshua Ramon Enslin 2022-09-08 16:07:30 +02:00
parent 1ed2959b62
commit 6f41ffeb9f
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE

View File

@ -242,17 +242,31 @@ final class NodaTimeSplitter {
if ($moda[0] !== $moda[1]) {
return "{$prefix}{$moda[0]}-{$moda[1]}{$suffix}";
}
// A single day of a given month of a given (single) year
else if (\intval($moda[2]) !== 0 and \intval($moda[3]) !== 0) {
return "{$prefix}{$moda[3]}.{$moda[2]}.{$moda[0]}{$suffix}";
}
// A single year
else if ($moda[0] === $moda[1] && trim((string)$moda[2], " 0") === "" && trim((string)$moda[3], " 0") === "") {
return "{$prefix}{$moda[0]}{$suffix}";
}
// Single month of a given year
else if ($moda[0] === $moda[1] && trim((string)$moda[2], " 0") !== "" && trim((string)$moda[3], " 0") === "") {
setlocale(LC_TIME, NodaTimeAutotranslater::LANGS_TO_LOCALES['de']);
$fmt = new IntlDateFormatter(
'de-DE',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
null,
IntlDateFormatter::GREGORIAN,
'MMMM Y'
);
try {
return $prefix . strftime(getMonthFormatByLang("de"), MD_STD::strtotime("{$moda[0]}-{$moda[2]}-01 01:01:01")) . $suffix;
return $prefix . $fmt->format(MD_STD::strtotime("{$moda[0]}-{$moda[2]}-10 01:01:01")) . $suffix;
}
catch (MDInvalidInputDate $e) {
return "";