×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Mar 2009
    Location
    Corinth, Greece
    Posts
    4

    Question Platform Services 1.0 - Calendar serv: Serious implementation bug or API Docs error!!

    Using Platform Services 1.0 to retrieve calendar entries I found that calendar entries that retrieved with GetList(criteria) calendar service function have a serious problem:

    the StartTime property and probably EndTime property of every calendar entry is NOT a Date object as mentioned in Platform Services API reference (Web Developer's Library 1.10), but a simple string, same if you use Date.toString() function!!

    I found a workaround but it's working ONLY if your device language is English!!:

    You can create a new Date object using:
    var aDateobj = new Date(calEntry.StartTime);

    The Date object constructor fortunately can parse this string and create a useful Date object.

    BUT if your device have any other language except English then the StartTime string is localized in the selected device language and then Date constructor parser DOES NOT recognize the date string!!!
    This resulted in a NaN value in every case!

    So Calendar service is almost complete useless for every device without english language!! ??

    Why Calendar Entries that retrieved with Platform Service 1.0 doesn't have StartTime & EndTime properties as a Date object and it's just a simple string?? There is a big problem with localization in this way!! I think that is simpler to implement Platform Service in this way but the localization support it's not consistent. Each developer must find his own way to parse localized string of StartTime property and in every language in world!!

    ...Or something is missing from Platform Services API reference in Web Developer's Library 1.10 and the solution is simpler that I can think...

    I'm looking forward for your opinion/solution!!

    George Paloukis

  2. #2
    Super Contributor
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Unhappy Re: Platform Services 1.0 - Calendar serv: Serious implementation bug or API Docs err

    Hi George,

    That is indeed a one serious bug. Actually it get's even worse with Platform services 2.0 as it uses the localized string returned by the PS 1.0 calendar API to construct the Date object, pretty much in similar way as you presented.

    Only real option is to pass the string as it is to the end user without any parsing, as they can read it. However then you lose the ability to control how the date is presented in your widget. Otherwise you would have to write a parser for all supported languages of your widget.

    Please see this Known Issue document for details:
    http://wiki.forum.nokia.com/index.ph...alised_strings

    Br,
    Ilkka

  3. #3
    Registered User
    Join Date
    Mar 2009
    Location
    Corinth, Greece
    Posts
    4

    Re: Platform Services 1.0 - Calendar serv: Serious implementation bug or API Docs err

    Hi Ilkka and thanks for your answer!

    I see what you said. This bug is worse than I was expecting!! It's already a known issue! So, the Global reach of more than 190 countries through Ovi Store seems summer-night dream :-)

    Does anyone that implemented these Platform Services and have access to its code could indicate to us a undocumented featured with, at least, could we get the date string as a IETF standard (RFC 1123 Section 5.2.14 and elsewhere) date syntax: "Mon, 25 Dec 1995 13:30:00 GMT" or ISO-8601?????

    I think that was the best way to implement Calendar service object, a standard date string format!! When you had created the JS Date object parsing this standard string, then you could present localized date string using standard JS method as:

    aDateObj.toLocaleString();

    Anyway, does anyone try to parse the date string using dojo.date.locale lib from Dojo toolkit?? I'm talking about a solution without much overhead, without the need to include all Dojo toolkit in WRT app package but only the necessary .js files.

    Another idea: is somewhere any list of all locales that a Nokia device use for represent date strings?? If we know how date localized strings represented in known-basic languages at least, then we can utilize the _decodeDate: function(dateString, format) of DatePicker in Guarana GUI to parse these strings and get the coveted Date object!!

    George Paloukis

  4. #4
    Super Contributor
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: Platform Services 1.0 - Calendar serv: Serious implementation bug or API Docs err

    Hello,

    Standard format would of course be the best or one could even cope with milliseconds as they are parsed with ease in JavaScript.

    However currently the returned date string is formatted as follows in the Symbian side by using TTime::FormatL.
    "%E,%D%N%Y %1 %2, %3%-B %:0%J%:1%T%:2%S%+B"

    You can check the original explanations of the different modifiers from here:
    http://developer.symbian.org/main/do...F-A8E937F836CF

    %E : Interpret the argument as the day name
    %D : Interpret the argument as the two digit day number in the month.
    %N : Interpret the argument as the month name.
    %Y : Interpret the argument as the four digit year number.

    The order of %1 %2, %3% is hard one as it depends on the clock settings. It can be either:
    Day, month , year
    Month , day, year
    Year, month , day

    %-B or %+B inserts the AM/PM symbol either the beginning (-B) or end (+B) if 12 hour clock is used.
    %:0 %:1 %:2 time separators from clock settings. Either : or .
    %J hour component of the time in either 12 or 24 hour clock format
    %T : minutes component of the time
    %S : two digit seconds component of the time

    Br,
    -Ilkka

  5. #5
    Registered User
    Join Date
    Mar 2009
    Location
    Corinth, Greece
    Posts
    4

    Re: Platform Services 1.0 - Calendar serv: Serious implementation bug or API Docs err

    Hello Ilkka,

    Thanks you a lot, your answer is very informative!

    I had concluded to the same results after some testing on real Nokia handsets (Nokia 5230 & X6) for various phone languages. The only thing I had missed is the possibility to have am/pm symbol at the beginning of time and not only at the end!

    At least, with your answer I confirmed that the date string format have a standard pattern (TTime::FormatL."%E,%D%N%Y %1 %2, %3%-B %:0%J%:1%T%:2%S%+B" ) for all phone languages!!

    I have already managed to make a flexible parser that works in any language you want. It parses the date string that calendar platform service provides and returns the corresponding JS Date object. It can parse correctly the date string for every possible clock setting on handset. If parser is unable to create a usable JS Date object then it's just returns the original date string as this provided from Calendar Platform Service. For every language you want to support, you must provide only an array with months names and the corresponding am/pm symbols in this language.
    Using the WRT localization system with <lang-token>.lproj folders, parser works automatically for the phone language that handset user has set.

    In the next days, after more testings with more languages, I could contribute this parser code to the Nokia Forum Community.

    George Paloukis

Similar Threads

  1. Replies: 1
    Last Post: 2010-08-29, 22:43
  2. A bug in calendar API
    By pranayama in forum Symbian
    Replies: 1
    Last Post: 2010-02-11, 19:51
  3. Replies: 1
    Last Post: 2009-10-28, 18:38
  4. Replies: 0
    Last Post: 2009-08-28, 15:44
  5. Disabling Touch Keypad + Platform Services Bug Fix
    By RobertBurdick in forum [Archived] Flash Lite on Nokia Devices
    Replies: 0
    Last Post: 2009-02-17, 06:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •