JosephMajaseSithole / datejs

Automatically exported from code.google.com/p/datejs
0 stars 0 forks source link

Unable to parseExact a string in a certain format #41

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I commented here - http://code.google.com/p/datejs/wiki/FormatSpecifiers - but 
realized that 
may not have been the right place.

I'm trying to parseExact a date string like "yyyy-MM-ddTHH:mm:ss.000-05:00" but 
the latter part 
(-05:00) breaks if it's a different time zone (-06:00) is present. I've tried 
using "P" (noted above) but 
no joy. I'm using trunk. I can't change the format... google calendar RSS. :)

I've also tried using just "c", but the presence of milliseconds in the string 
breaks it.

Anything I can try?

Original issue reported on code.google.com by redeemer...@gmail.com on 24 May 2008 at 3:30

GoogleCodeExporter commented 8 years ago
Yep, this is a problem. The millisecond value in the iso 8601 format will cause
problems in the regex parsing. Without the millisecond value everything should 
be
fine. I have not had a chance to investigate a fix, but it will almost certainly
involve an addition or modification to the regex that attempts to parse the
millisecond part. 

Original comment by geoff%co...@gtempaccount.com on 25 May 2008 at 3:28

GoogleCodeExporter commented 8 years ago
This issue has gained higher visibility after Blogger changed the output format 
of
their Atom feeds. The "updated" field now shows dates like:

2003-12-13T18:30:02.25+01:00

Unfortunately datejs is unable to parse this.
Is there a simple workaround while this bug is fixed?

Original comment by sergio.n...@gmail.com on 25 May 2008 at 4:01

GoogleCodeExporter commented 8 years ago
Just a quick note to add that these are valid RFC 3339 dates:

http://www.ietf.org/rfc/rfc3339.txt

Original comment by sergio.n...@gmail.com on 25 May 2008 at 4:07

GoogleCodeExporter commented 8 years ago
FYI, for my immediate purposes, I just grepped the milliseconds out of the 
string.

Original comment by redeemer...@gmail.com on 27 May 2008 at 4:44

GoogleCodeExporter commented 8 years ago
Hi, here is patch that fixes the ISO 8601 milliseconds format problem.
Adds a new "iii" format, matches 3 digits with optional start dot
Adds a new format to use with parse() that parses ISO 8601 with milliseconds

Original comment by mattias....@gmail.com on 5 Feb 2010 at 4:38

Attachments:

GoogleCodeExporter commented 8 years ago
New patch, use "ss.s" as format instead which is much better and according to 
the 
format specification

Original comment by mattias....@gmail.com on 5 Feb 2010 at 7:43

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
patched in my current fork: https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 9 Sep 2013 at 7:57