Skip to Content

SAP WebIDE - UI5 - Date field is not showing correct date

Hi,

I am using UI5 version 1.44. There is one date field (Date picker) in the application. Database value for this field is for ex: 21Dec2017. The value of this field at Gateway system is the same as database value while oData service testing. When I use UI5 application, it is showing as 20Dec2017. It is always showing one day less to database value. I tested with different dates. it is responding in the same manner. Did I miss anything? please help me to fix this issue.

Thank you,

Balaji P.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Jan 24 at 11:01 PM

    I was in chat with SAP and fixed the issue..

    In my index file of the project, there are library names..

    data-sap-ui-libs="sap.m,sap.ui.commons,sap.ui.table,sap.ui.ux3"

    SAP suggested to remove all except "sap.m"

    and format for date as below.

    <DatePicker value="{path: 'Begda', type: 'sap.ui.model.type.Date', formatOptions: {pattern: 'MM/dd/yyyy', strictParsing: true , UTC: true}}" width="10em" id="Begda" required="true"/>

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 24 at 05:15 PM

    what data type of that field?

    your fontend code?

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 24 at 03:30 AM

    Hello, Balaji. Does the UI5 application is running on server has different time zone with your Database service?

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Richard,

      Thank you for the response. My backend SAP system, Gateway system and my PC all are in PST. Is there any option to check timezone in WebIDE?

      Thank you,

      Balaji P.

  • Jan 24 at 08:19 PM

    Dear Balaji,
    I also faced the same issue, I solved it by appending custom timer in my controller,

    	var date = new sap.ui.model.type.Date();
    			date = this.getView().byId("dt_dtField").getValue();
    			date = new Date(date + " 11:13:00"); 
    
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 24 at 05:48 PM

    Hi Jun,

    Field data type is "DatePicker". This is automatically assigned when I use ref.field from Model.

    Thank you,

    Balaji P.

    Add comment
    10|10000 characters needed characters exceeded