SAP Learner
SAP Learner

Reputation: 61

SAPUI5 Date mismatch in oData

I am passing date from sap.m.DatePicker to oData service filter. I have used JSON model bound to date picker to access the date chosen by the user.

My issue is: When I choose 1st Oct 2018 as the date, I see the date as 30th Sep 2018 (20180930 as per SAP backend format) in debug session. It is always going 1 date behind in Gateway oData service.

What has gone wrong here!!

I tried various approaches like date.setHours(0,0,0,0), date.setUTCHours(0,0,0,0) etc from front end. But my issue was never resolved. I guess it is something with respect to timezone.

Can someone please guide me what is the issue here.

Upvotes: 1

Views: 3247

Answers (1)

basti
basti

Reputation: 21

This is a common issue with transfering Dates back to the backend. This happens because the time of the date is midnight and a conversion according to time zone takes place when submitting the date to the backend system. A work around could be to set the hours of the date object to 12 before submitting the object as a filter value.

Upvotes: 1

Related Questions