Skip to Content
0

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

Jan 22 at 10:51 PM

150

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Balaji Peethani Jan 24 at 11:01 PM
0

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"/>

Share
10 |10000 characters needed characters left characters exceeded
Jun Wu Jan 24 at 05:15 PM
1

what data type of that field?

your fontend code?

Share
10 |10000 characters needed characters left characters exceeded
Richard Zhao
Jan 24 at 03:30 AM
0

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

Show 1 Share
10 |10000 characters needed characters left 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.

0
Hamdan Khalid Jan 24 at 08:19 PM
0

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"); 
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Khalid,

Thank you for the response. I also did manipulation like this but it is in Get method.

Thank you,

Balaji P.

0
Balaji Peethani Jan 24 at 05:48 PM
0

Hi Jun,

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

Thank you,

Balaji P.


datepicker.jpg (82.3 kB)
Share
10 |10000 characters needed characters left characters exceeded