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

Not only that, but ISO 8601 also allows you to just specify the year, but Date.iso8601("2012") raises an ArgumentError "invalid date". Nor does it support "week dates", Date.iso8601("2012-W01") raises an ArgumentError too.

I don't know the standard, but either Wikipedia is wrong or the Date implementation is sorely lacking.



It may well be lacking in completeness, but I bet it covers over 99% of actual real-world ISO8601 dates. When was the last time you ran across a "week date"?


Very common in Europe, where businesses often operate relative to weeks; we frequently use week numbers for that reason (an abomination in my opinion). Ruby has decent but not great support for ISO week numbers.


Yep, an example: I edit OpenStreetMap. The opening_hours property allows one to represent a wide range of opening hours. https://wiki.openstreetmap.org/wiki/Key:opening_hours

A lot of public parks in London are open at different times during summer and winter.

Here's an example I added personally, the churchyard of St Anne's Church in Soho. http://www.openstreetmap.org/browse/way/40879988

"week 1-13 Mo-Su 10:00-16:00; week 14-43 10:00-18:00; week 44-52 10:00-16:00"


Yep. There's a lot more problems than that.

I've been reading the source code of one ISO 8601 implementation in JavaScript and writing my own in Java. Looks like I'll have to fix the Ruby one too.

Given that it's used by, oh, HTML and XML, not properly implementing ISO 8601 is really no big deal.</sarcasm>




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

Search: