Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Wrong date value selected from calendar using Firefox/IE

Hi all!

This custom app was developed using WebIDE. Now I have deployed the app locally to the customer system and while testing it using different browsers I noticed a strange bug when using Firefox or IE11:

I have a calendar view which retrieves infotype 2001 and 2002 entries from the backend for the selected date. When I select a date in the calendar, the app fetches time entries for the previous day instead of the selected day:

The browser debugger shows that it sends the GET command with wrong date values to the backend:

GET zxyListSet?$skip=0&$top=20&$filter=Begda%20eq%20datetime%272015-07-14T21%3a00%3a00%27%20and%20Endda%20eq%20datetime%272015-07-14T21%3a00%3a00%27%20and%20substringof(%123456789%27,Pernr)&$inlinecount=allpages

So, somewhere between the click and the formation of the URI the date value gets corrupted. This happens systematically for all dates, and it's always 1 day off.

But when using Chrome (and Chrome portable) the calendar selection works just fine! It fetches the correct day.


Also the WebIDE version behaves the same way, so it's not related to the code migration.

Since the users are mostly using IE and Firefox, this needs a remedy, so I'm asking you experts for help.

The customer system is having SAPUI5 runtime 1.28.5. And I think WebIDE is having 1.28.9.

Thanks for any help or tips!

br,

Ossi M

Tags:
replied

Hi Ossi.

I think that is when you use the .filter for the binding items in the table, the system auto convert the filter time value from browser's time zone to GMT+0 time value.

You should change from "T00:00:00" to your's TimeZoneOffset

The browser has a method to get TimeZoneOffset:

     var TZOffsetMs       = new Date();

         TZOffsetMs         = - TZOffsetMs.getTimezoneOffset();

     var timeZoneHs;

     var timeZoneMs;

     timeZoneMs = TZOffsetMs % 60;

        timeZoneHs = ( TZOffsetMs - TZOffsetMs % 60 ) / 60 ;

        if (timeZoneHs < 10) timeZoneHs = "0" + timeZoneHs ;

        if (timeZoneMs < 10) timeZoneMs = "00";

oControlEvent.mParameters.date.substring(8, 10) + "T00:00:00" "T"+ timeZoneHs + ":" + timeZoneMs + ":00";

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question