[Dojo-interest] Date Parsing

shaun_stanworth at wordbank.com shaun_stanworth at wordbank.com
Tue Apr 15 10:14:31 UTC 2008


Hi

That's not quite the issue - date_str is "2008-05-05" for example, the 
values in public_holidays refer to descriptions.

So what is effectively being called is 
dojo.date.local.parse("2008-05-05", {datePattern: "yyyy-MM-dd"});

It seems like this would be a common feature, but if it isn't possible 
then I'm sure I can work something out.

Thanks

Shaun

Nicola Rizzo wrote:
> If public_holidays is an array, try this:
>
> dojo.date.locale.parse(public_holidays[date_str], {datePattern:"yyyy-MM-dd"});
>
> Regards,
>    Nicola
>
>
> On Tue, Apr 15, 2008 at 10:48 AM,  <shaun_stanworth at wordbank.com> wrote:
>   
>>  Hi there
>>
>>  I'd like to parse a date of the format yyyy-MM-dd (i.e. 2008-12-25).
>>
>>  However when I do (where public_holidays is an array with date strings
>>  as keys):
>>
>>  function convert_to_dates(public_holidays) {
>>     var hols = new Array();
>>     if (public_holidays != undefined) {
>>         for (date_str in public_holidays) {
>>             var date = dojo.date.locale.parse(date_str, {datePattern:
>>  "yyyy-MM-dd"});
>>             hols.push(date);
>>         }
>>     }
>>     return hols;
>>  }
>>
>>  date is being set to null. I don't get any Javascript errors, though I
>>  couldn't find an example of this kind of parsing in the docs, so I'm
>>  assuming I'm just calling it incorrectly.
>>
>>  Any help would be appreciated!
>>
>>  Thanks
>>
>>  Shaun
>>
>>
>>  _______________________________________________
>>  FAQ: http://dojotoolkit.org/support/faq
>>  Book: http://dojotoolkit.org/docs/book
>>  Forums: http://dojotoolkit.org/forum
>>  Dojo-interest at dojotoolkit.org
>>  http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>     
> _______________________________________________
> FAQ: http://dojotoolkit.org/support/faq
> Book: http://dojotoolkit.org/docs/book
> Forums: http://dojotoolkit.org/forum
> Dojo-interest at dojotoolkit.org
> http://turtle.dojotoolkit.org/mailman/listinfo/dojo-interest
>   

-- 
Shaun Stanworth
Senior Analyst Programmer
Wordbank Limited
33 Charlotte Street, London W1T 1RR
Direct Line: +44 (0) 20 7903 8830
Fax:  +44 (0) 20 7903 8888



More information about the Dojo-interest mailing list