简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM