Live data from Hacker News

Ruby 1.9 doesn't implement ISO 8601 properly

tommorris.org

1–10 of 50 posts

Re: Ruby 1.9 doesn't implement ISO 8601 properly

#3
post #2

I think it would make the point much clearer if the author of that article would actually explain a use case for this (apparently incorrectly handled) syntax which I have never ever come in contact with :).

Well the point is that they shouldn't call the method iso8601 if it doesn't implement the whole iso8601 standard

Re: Ruby 1.9 doesn't implement ISO 8601 properly

#4
post #2

I think it would make the point much clearer if the author of that article would actually explain a use case for this (apparently incorrectly handled) syntax which I have never ever come in contact with :).

Usecase is that there are various embedded/industrial/enterprise systems that return and expect dates in either of those two formats as part of their API. Either because they want to represent the idea of "month" or because they don't care about days and not about week days and months (Implementing whole calendar in random embedded/industrial system is unnecessary busywork that costs you not only effort but also code size)

Re: Ruby 1.9 doesn't implement ISO 8601 properly

#5
post #2

I think it would make the point much clearer if the author of that article would actually explain a use case for this (apparently incorrectly handled) syntax which I have never ever come in contact with :).

1) It's in the standard. If you call a function iso8601 you better follow that standard. Or document where the function deviates from it.

2) Just because you didn't come in contact with ordinal dates doesn't mean others don't need it.

3) The article has a link to https://en.wikipedia.org/wiki/Ordinal_date. The wiki page doesn't have any specific use cases but just use your imagination.

Re: Ruby 1.9 doesn't implement ISO 8601 properly

#6
post #3
post #2

I think it would make the point much clearer if the author of that article would actually explain a use case for this (apparently incorrectly handled) syntax which I have never ever come in contact with :).

Well the point is that they shouldn't call the method iso8601 if it doesn't implement the whole iso8601 standard

That's a bold statement. I don't think I've ever seen a program / library which implements any standard completely and without issues. It's not uncommon to see a list of things that are not done, incomplete, or just called out as wrong and rejected from the implementation.

It's not perfect, but no implementation will ever be imho.

Re: Ruby 1.9 doesn't implement ISO 8601 properly

#7
post #2

I think it would make the point much clearer if the author of that article would actually explain a use case for this (apparently incorrectly handled) syntax which I have never ever come in contact with :).

1) It's in the standard. If you call a function iso8601 you better follow that standard. Or document where the function deviates from it. 2) Just because you didn't come in contact with ordinal dates doesn't mean others don't need it. 3) The article has a link to https://en.wikipedia.org/wiki/Ordinal_date . The wiki page doesn't have any specific use cases but just use your imagination.

[deleted]

Re: Ruby 1.9 doesn't implement ISO 8601 properly

#8
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

#9
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.

Post reply on HN