Skip to Content
0
Former Member
Sep 18, 2017 at 01:19 PM

SAPUI5 Date Conversion: getDateTimeInstance() - Different Behavior for Different Languages

2004 Views Last edit Sep 19, 2017 at 10:49 AM 2 rev

Dear All,

I am doing date format using this function sap.ui.core.format.DateFormat.getDateTimeInstance({ pattern: "YYYY-MM-ddTHH:mm" });.

converting to string from date object.

The date format is working fine in "EN" but it is returning wrong value in "DE".

Reproduceable in DE . Change your browser language to DE. Close and open browser. use bellow link to see the issue

http://jsbin.com/ficezasuxo/1/edit?html,output

The date input value is 01.01.2021 but its returning 01.01.2020 in "DE"

I did debug F11. In DateFormat-dbg.js bellow highlighted method is called and when highlighted line changes the date value.

the line is calling UniversalDate-dbg.js file is getting called.

In UniversalDate-dbg.js highlight if else block is executing for different language.

data value 01.01.2021,02.01.2021,03.01.2021 is not working 04.01.2021 is working Because else if (oDate < oFirstDay) is like (04.01.2021 < 04.01.2021).

Check for var oFirstDay

else block is executing for EN.

Best Regards,

Sathish Mani

Attachments

dateformat.png (146.8 kB)
odataformatdbg.png (314.6 kB)
universaldate.png (204.3 kB)
calender.png (21.6 kB)