Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

datejs parse errors on iPhone since 1.1.0

I have been using the datejs library in my app since 0.8. As of 1.1.0 I have been getting a lot of failures in the Date.parse() function. Parsing times with AM or PM (eg. '8:11 AM') specified will always fail and return null. '8:11' without the AM works fine.

I have uploaded a sample app that recreates the issue to pastie. You can checkout the date.js from svn, but Titanium has issues parsing it. I have uploaded a version that gets rid of the compiler warnings to pastie

Again, this was working fine in Titanium 0.8 and 1.0, but fails in 1.10 and higher.

eta: It seems to work fine on actual hardware. It only fails on the iPhone simulator (v3.1+).

— asked April 9th 2010 by Charles Jones
  • date
  • datejs
  • iphone
  • mobile
  • parse
1 Comment
  • Hi Charles. Thanks for the resource on Pastie. How did you actually implement this? I am trying to use the very useful add function. Could you give me a tiny sample of code? Do you require the file and then call the methods?

    Thanks

    — commented September 8th 2011 by Leonardo Amigoni

4 Answers

  • i am also getting issues with this every time i try to run titanium with debug to use breakpoints it just hits the date.js plugin and titanium gives a lot of errors i have tried the latest

    — answered August 28th 2012 by Samuel East
    permalink
    0 Comments
  • Dates appear to be broken in Titanium… compare to node.js:

    var datestr = "2011-02-25T23:48:16Z";
    console.log(Date.parse(datestr));
    1298677696000
    

    Where as Titanium:

    var datestr = "2011-02-25T23:48:16Z";
    Ti.API.info(Date.parse(datestr));
    
    [INFO] nan
    

    Not sure of a good work around…

    — answered May 9th 2011 by todd fisher
    permalink
    0 Comments
  • Yes, I'm also having this problem, I don't know if Appcelerator is working on this, I hope so…

    — answered July 27th 2011 by Cedrik Boudreau-Batista
    permalink
    0 Comments
  • Any news on this one? Is it working now?

    — answered September 8th 2011 by Leonardo Amigoni
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.