cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi All,

The issue has beed fixed by adding Parameter UTC:false.

sap.ui.core.format.DateFormat.getDateTimeInstance({ pattern: "YYYY-MM-ddTHH:mm" ,UTC:false});

Best Regards,

Sathish Mani

Answers (0)