myusuf3 / delorean

Delorean: Time Travel Made Easy
http://delorean.rtfd.org/
MIT License
1.84k stars 128 forks source link

Add a wrapper for babel's parse_pattern() #92

Closed Lukas0907 closed 8 years ago

Lukas0907 commented 8 years ago

Sometimes you want more control over the parsing process than the heuristic of dateutil's parse function can give you or you have really weird strings. Since babel is already used for formatting the output, it would be quite handy to also have the parse_pattern() function available: http://babel.pocoo.org/en/latest/api/dates.html#babel.dates.parse_pattern It accepts the same patterns and also a locale.

I could provide a pull request if this is deemed useful.

myusuf3 commented 8 years ago

I would be interested in seeing what this entails and thoughts on api first before you were to code it up. few example uses would be good too. @Lukas0907

Lukas0907 commented 8 years ago

I just found out that parse_pattern() actually does not parse a date using a pattern but just creates a pattern object. I misinterpreted that. So just ignore this issue. :)