PHP Symfony backend need a "format datetime" working same way that frontend Angular DateFormat.DATE_TIME

25 views Asked by At

I work in a company that use Angular in the frontend. The Angular format DateFormat.Date_TIME is hour zero-padded by default.

But, in the backend, that use PHP Symfony v6.4, with Twig v3.7 using

{{ date| format_datetime('short', 'short', locale=locale, timezone=false)}}

with locale, we have hours non zero-padded.

As the case can work with locale=en_US or locale=es_MX, we dont want to use the function's "pattern" parameter to solve the problem, specifying special format for every case. In the same way, we don't want to code a custom solution, because we'll need to do it to every cases after...

Do you know if in Symfony v6.4, exist a library that work as Angular, with hours zero-padded by default?

Thanks in advance, have a good coding day!

I've tried to find a parameter to specify that we want zero-padded hours with format_datetime(). But doesn't exist.

So now, I want to know if there is another solution that have the Angular's behavior by default.

0

There are 0 answers