Skip to Content
0

Smart Table - Date column timezone issues, date 1 day less

May 21, 2017 at 11:25 AM

817

avatar image

I have a Smart Table and I am filling Created Date from the oData Service.

In the oData Service the date comes in as - Date(1495152000000)

The date in my ECC is a Datum field and has value - 05/19/2017

I am currently in IST time zone and for me the JavaScript Date object comes as - Fri May 19 2017 05:30:00 GMT+0530 (India Standard Time)

The client is in CST time zone and for them the JavaScript Date object comes as - Thu May 18 2017 19:00:00 GMT-0500 (Central Daylight Time)

I understand this is happening because JavaScript takes the local system time zone and then renders the same.

The solution for this can be found in the blog - https://blogs.sap.com/2013/04/28/working-with-odata-dates/

As per this, I need to add the Time zone offset and I should be good.

As per another blog - https://archive.sap.com/discussions/thread/3889690 and https://archive.sap.com/discussions/thread/3602595 , I can setUTCDate function of JavaScript too.

The issue I am facing is I am auto binding my data to the Smart table, so how do I change these values in the front end.

Also as per blog - https://archive.sap.com/discussions/thread/3441583 , setting the sap:display-format="Date" for my Property. I have done this in my annotations, but this doesn't solve my problem.

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

1 Answer

Best Answer
Rohit Chokhani May 29, 2017 at 04:22 PM
0

This is solved by using a formatter and converting the date in the formatter by considering the time zone offset.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

You can just add a custom data attribute to the smart filter bar with the date format settings:

<sfb:customData>
<core:CustomData key="dateFormatSettings" value='\{"UTC": true}' />
</sfb:customData>
0