Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 28
Registered: ‎09-21-2012
My Device: DTEK50
My Carrier: Telekom.de
Accepted Solution

Timezone in Webworks not working correctly with OS 7.1.0.342 on BB9810

Hi developers,

 

we are currently running into an issue to gather the correct time on a BlackBerry 9810 (OS 7.1.0.342 b1149).

In Germany we now have GMT+2 due to DST and the Javascript framework is always returning the wrong time (GMT+1).

 

On 9810 devices with OS 7.1.0.1033 b2807 the same code is returning the right time. So this behaviour seems to be a bug in WebWorks?!

 

We have about 400 devices with the old 7.1.0.342 b1149 OS across our environment, so we are not easily able to do a OS update on all these devices... The webworks application is a big data management which is working together with a SAP backend. The SAP backend is reporting errors due to the wrong time zones, so we can't use the app anymore.

 

Can you imagine any workaround to get the correct time zone?

 

Thank you for your support and help!

 

Thanks,

Daniel

BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Timezone in Webworks not working correctly with OS 7.1.0.342 on BB9810

Hi there,

 

How abouts are you getting the current time from the phone? Do you have a code snippet you'd be able to share?

Developer
Posts: 28
Registered: ‎09-21-2012
My Device: DTEK50
My Carrier: Telekom.de

Re: Timezone in Webworks not working correctly with OS 7.1.0.342 on BB9810

Hi Chad, We tried many different ways to get the time. Currently the app includes the jQuery plugins. So we used jquery.now() Basic javascript with var t = new Date() Is returning the wrong time too...
BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Timezone in Webworks not working correctly with OS 7.1.0.342 on BB9810

Okay thanks, that's very strange... and these devices are on a cell network, and show the proper time when you actually look at the phone?

Developer
Posts: 28
Registered: ‎09-21-2012
My Device: DTEK50
My Carrier: Telekom.de

Re: Timezone in Webworks not working correctly with OS 7.1.0.342 on BB9810

Yes. They are all set to choose the correct timezone, date and time from cellular. If we look at the phone, the information are right at all. The code snippets returning the right time if we switch manually to a different time zone with GMT+2 in settings. But not with our timezone (Amsterdam, Berlin).
BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Timezone in Webworks not working correctly with OS 7.1.0.342 on BB9810

Thanks, I'll check in with the team and see if there's anything I can offer to help get around this issue.

BlackBerry Development Advisor
Posts: 762
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: Timezone in Webworks not working correctly with OS 7.1.0.342 on BB9810

Okay so I did a big of digging around and from what I can tell this is not a problem with WebWorks.

 

According to this StackOverflow thread, us developers need to be checking if DST is in effect or not. Have a quick look at the solution posted here -> http://stackoverflow.com/questions/11887934/check-if-daylight-saving-time-is-in-effect-and-if-it-is-...

 

They do state that this works for international timezones as well. 

 

Hopefully this is what you were looking for! 

 

-Chad

Developer
Posts: 28
Registered: ‎09-21-2012
My Device: DTEK50
My Carrier: Telekom.de

Re: Timezone in Webworks not working correctly with OS 7.1.0.342 on BB9810

Hi Chad,

 

thank you for the link. We looked at the code posted there and found a bug within the JavaScript code of the old OS 7.1 bundle for BlackBerry 9810.

 

We tried the following code with both OS bundles:

 

var d, i, lastoffset, newoffset;
i=i;
lastoffset = 0;

while(i <365) {
 d = new Date(2014, 0, 1, 12, 0);
 d.setDate(i);
 newoffset = d.getTimezoneOffset();
 console.log(d);
 if(lastoffset !== newoffset) {
  alert(d);
 }
lastoffset = newoffset;
i++;
}

 

This code is searching for days where the time changes from DST to normal time.

 

The old OS is returning the 04/01/2014 and 11/01/2014 (that's wrong!)

The latest OS build is returning the correct date: 03/30/2014 and 10/26/2014

 

Today (04/02/2014) the app is working properly, because the Javascript environment is returning the right time again. But we will run into the issues again in autumn. 

 

So now we are going to update all of our devices to the latest OS.

 

Thanks for your support!