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
Contributor
djpip27
Posts: 29
Registered: ‎03-30-2012
My Device: Developer - Curve 8250
My Carrier: Virgin Mobile
Accepted Solution

BB10 Calendar Functions WebWorks SDK 1.0.3.8

Hi all,

 

Trying to intergrate the new calendar goodness into my BB10 application.

 

varStart = "20121129193000";

varDateStart = newDate(start.charAt(0) + start.charAt(1) + start.charAt(2) + start.charAt(3), start.charAt(4) + start.charAt(5), start.charAt(6) + start.charAt(7), start.charAt(8) + start.charAt(9), start.charAt(10) + start.charAt(11), 00);

 

The remote debugger then shows the date:

Sat 29 Dec 19:30:00

 

This is incorrect, the date I am expecting is Thursday 29th November 19:30:00.

 


Secondly, the operation where the date is added to the calendar returns error code 20 on the Dev Alpha.

Does anyone know where there is a list of error codes for BlackBerry 10 Development and WebWorks or what this one means - is it permissions based?

Please use plain text.
Contributor
djpip27
Posts: 29
Registered: ‎03-30-2012
My Device: Developer - Curve 8250
My Carrier: Virgin Mobile

Re: BB10 Calendar Functions WebWorks SDK 1.0.3.8

Okay, solved 1 problem. It was a permissions issue, was missing the <rim:smileytongue:ermissions> start and close tags.

Still be nice to know if there is a list of these cryptic error codes though. Also the date problem remains.

 

  <rim:smileytongue:ermissions>
    <rim:smileytongue:ermit>access_pimdomain_calendars</rim:smileytongue:ermit>
  </rim:smileytongue:ermissions>

Please use plain text.
BlackBerry Development Advisor (Retired)
mimendoza
Posts: 64
Registered: ‎06-04-2012
My Device: Blackberry Z10
My Carrier: Bell

Re: BB10 Calendar Functions WebWorks SDK 1.0.3.8

The date problem occurs because the month index starts at 0, therefore 0 = January and 11 = December. For easier readability, you can try to format the "start" variable in order to use it when creating a date object instead of grabbing the characters one by one.
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date#Example:_Several_w...
----------------------------------------------------------------------------------
- Did this post help solve the issue? Click on "Accept as Solution"
- Was the content of this post helpful? Please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Please use plain text.
Contributor
djpip27
Posts: 29
Registered: ‎03-30-2012
My Device: Developer - Curve 8250
My Carrier: Virgin Mobile

Re: BB10 Calendar Functions WebWorks SDK 1.0.3.8

[ Edited ]

Oh okay, appologies for that - didn't realise that is specific for months. Seems a bit odd to me personally, given that days do obviously start with 1. I'm assuming there is some clever reason why the months are 0-11, but what an annoying pitfall to run into.

 

Thanks for your help!

Please use plain text.
BlackBerry Development Advisor (Retired)
mimendoza
Posts: 64
Registered: ‎06-04-2012
My Device: Blackberry Z10
My Carrier: Bell

Re: BB10 Calendar Functions WebWorks SDK 1.0.3.8

No problem, glad to help. I'll just add some examples here:

var d = new Date("2012 11 29"); 
does not give the same output as
var d = new Date("2012", "11", "29");
If each parameter (y,m,d) is passed separately, they are interpreted as integer values (starting from index 0). You can test it out like this:
var a = new Date("2012 November 10");
a.getMonth();
// the output is: 10

var b = new Date("2012 December 10");
b.getMonth();
// the output is: 11
----------------------------------------------------------------------------------
- Did this post help solve the issue? Click on "Accept as Solution"
- Was the content of this post helpful? Please give it a "Thumbs Up"

developer.blackberry.com
@BlackBerryDev
Please use plain text.