Skip to Content

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

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 -

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

As per another blog - and , 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 - , setting the sap:display-format="Date" for my Property. I have done this in my annotations, but this doesn't solve my problem.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 29, 2017 at 04:22 PM

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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

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

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