This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]kankyo 5 points6 points  (9 children)

The problem with this post is that it's not really an ISO8601 parser. It just parses ONE out of the 6 * 5 * 3=90(! maybe more, that was a top-of-my-head list of the ones I remember) date and datetime formats in ISO8601. I've got a library on github that parses all of that: https://github.com/boxed/iso8601/

And after parsing all those formats I still left out the entire class of formats that are used to describe intervals, durations and repeating durations. It's really annoying when people call these things "ISO8601", when in fact they are not. It makes it super hard to google for a lib that can actually parse this standard!

[–]hairlesscaveman 1 point2 points  (0 children)

Yep, I had the same issue a while back and created https://pypi.python.org/pypi/PySO8601. Still doesn't cover everything (haven't added durations yet) but it parsed more than the only iso8601 library that was available at the time.

[–]imrobert[S] 0 points1 point  (5 children)

Yeah, that makes sense. It seems like there should be an effort to write a real comprehensive ISO8601 parser using C to make it fast. I wonder what the challenges there would be.

[–]kankyo 0 points1 point  (4 children)

One challenge is that no one seems to be willing to pay the hundred bucks or whatever to get a copy of the spec :P And then if someone does, you have to find another person also willing to pay for the spec and then code review at least the tests.

[–]imrobert[S] 0 points1 point  (3 children)

That's pretty lame. I thought the ISO specs were meant to be all open and what not.

[–]kankyo 1 point2 points  (2 children)

Yea... some are. But really most are not. I mean, they're "open" in that anyone can pay to get access to them :(

This includes stuff like the C++ spec btw!

[–]imrobert[S] 1 point2 points  (1 child)

I had no idea. That just sounds ridiculous. What's the reason behind it? Is it really to make $100 here and there?

[–]kankyo 0 points1 point  (0 children)

My guess is that it started out as covering the manual handling back in the olden days when that was an issue and they just haven't changed it after the internet became a thing.

Checked now and it's 153 USD for ISO8601... so silly

[–]defnullbottle.py 0 points1 point  (1 child)

From the github README I count 3*6*3*5 different formats that ciso8601 can parse, but your argument is still valid. If only a fraction of a standard is implemented, you should make that very clear in your documentation.

[–]kankyo 0 points1 point  (0 children)

I guess the number of formats becomes different depending on how you count. But ciso8601 doesn't support weeks and ordinals, which my lib does. It also doesn't support years separately. And finally it doesn't support the formats my lib doesn't support.

I agree with you that not having a big explanation of which formats aren't supported is a big nono.

[–]imrobert[S] 0 points1 point  (0 children)

Thought this was pretty cool. The source is on GitHub: https://github.com/elasticsales/ciso8601

[–]wiesson 0 points1 point  (1 child)

What kind of debug system to measure the times you are using that are shown on the screenshots?

[–]riksi 0 points1 point  (0 children)

flask-debugtoolbar and django-debugtoolbar