Both of these modifiers call strftime()
which is deprecated in PHP 8.1 and will be removed in PHP 9.
If they’re rewritten to use date()
, they’ll break existing code, since the formatting tokens are different. They’ll also lose the ability to translate things like day and month names into languages other than English.
They could use the new DateTime object, but it also gives only English output (and the format strings would still be wrong).
The only alternative that I know of that will handle multiple languages is the IntlDateFormatter
object, which is fairly complicated and requires the Intl extension to PHP. I think it would also break existing code unless the strftime()
format characters are translated to the date()
format.
My version of XAMPP doesn’t have the Intl extension and I’m not sure how common it is in typical PHP installations.
One solution would be to use the date()
function or DateTime
, and include MODX language tags in the format string, which would have to be escaped, letter-by-letter in the format string, or replaced with escaped tokens, extracted before calling date()
, then put back later.
Another solution might be to create a :DateTime
output modifier with an option to use the IntlDateFormatter methods for those who know the Intl extension is installed.
I’m hoping that there’s a simple solution that I haven’t thought of.