Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
6397 Zobrazení

In the pos.xml file,  how do I change the date format  to display dd/mm/yyyy ?


    <t t-name="PosTicket">
        <div class="pos-sale-ticket">
            
            <div class="pos-center-align"><t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
                Date.CultureInfo.formatPatterns.longTime)"/> <t t-esc="order.get('name')"/></div>
            <br />

Avatar
Zrušit
Nejlepší odpověď

Try this:

<t t-esc="new Date().getDate()+'/'+new Date().getMonth()+1+'/'+new Date().getFullYear()"/>

It's not an elegant way to do it, but seeing as no one else has answered, I thought I'll comment.

I have added +1 to the month because JavaScript starts months from 0-11.

I would recommmend you to test it with different dates to make sure it does not break.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
dub 23
4072
1
kvě 19
3145
1
kvě 18
5144
0
led 16
4666
2
srp 15
4838