Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



I wonder how Perl's DateTime::Format::ISO8601 [1] holds up...

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


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: