News for hackers. Stuff that matters.
Re:Ruby 1.9 doesn't implement ISO 8601 properly by wyuenho on Sunday February 24, 2013 @10:57AM (#5274617)
So do tons of other libraries and PL standard libraries. jodatime in Java, moment.js, JS' Date object, python's datetime stdlib module, python-dateutil etc. ISO-8601 is actually quite a difficult standard to program for. 9 out of 10 times, these libraries either don't support just year, year-month, or both. 9 out of 10 times, when a datetime object is formatted to a string, you see inconsistencies about that dangling Z marker at the end.

Tom Morris is right, they all suck when it comes to ISO-8601 support.

Re:Ruby 1.9 doesn't implement ISO 8601 properly by eCa on Sunday February 24, 2013 @12:08PM (#5274909)
I wonder how Perl's DateTime::Format::ISO8601 [1] holds up...

[1] https://metacpan.org/module/DateTime::Format::ISO8601

Re:Ruby 1.9 doesn't implement ISO 8601 properly by draegtun on Monday February 25, 2013 @06:40AM (#5278438)
Seems to be fine:

  $ re.pl

  >> use aliased 'DateTime::Format::ISO8601';

  >> ISO8601->parse_datetime("2012-012");
  2012-01-12T00:00:00

  >> ISO8601->parse_datetime("2012-366");
  2012-12-31T00:00:00

  >> ISO8601->parse_datetime("2012-12");
  2012-12-01T00:00:00

  >> ISO8601->parse_datetime("2012");
  2012-01-01T00:00:00
And if it isn't then there is also Date::ISO8601 [1] which is written by Zefram [2] who is renowned for being a Date/Time nut [3] :)

1 - https://metacpan.org/module/Date::ISO8601

2 - https://metacpan.org/author/ZEFRAM

3 - https://metacpan.org/module/Date::Darian::Mars