Remove deprecated strfttime in NodaTimeSplitter
This commit is contained in:
parent
1ed2959b62
commit
6f41ffeb9f
@ -242,17 +242,31 @@ final class NodaTimeSplitter {
|
|||||||
if ($moda[0] !== $moda[1]) {
|
if ($moda[0] !== $moda[1]) {
|
||||||
return "{$prefix}{$moda[0]}-{$moda[1]}{$suffix}";
|
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) {
|
else if (\intval($moda[2]) !== 0 and \intval($moda[3]) !== 0) {
|
||||||
return "{$prefix}{$moda[3]}.{$moda[2]}.{$moda[0]}{$suffix}";
|
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") === "") {
|
else if ($moda[0] === $moda[1] && trim((string)$moda[2], " 0") === "" && trim((string)$moda[3], " 0") === "") {
|
||||||
return "{$prefix}{$moda[0]}{$suffix}";
|
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") === "") {
|
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 {
|
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) {
|
catch (MDInvalidInputDate $e) {
|
||||||
return "";
|
return "";
|
||||||
|
Loading…
Reference in New Issue
Block a user