on 05-21-2017 12:25 PM
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.
This is solved by using a formatter and converting the date in the formatter by considering the time zone offset.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.