[patch] add fuzzy parsing for underspecified dates
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dateutil |
New
|
Undecided
|
Unassigned |
Bug Description
Hi Gustavo,
I am writing to offer a patch for python-dateutil, which should apply
cleanly to the 1.x and the 2.x trees. I'm most concerned with updating
the 1.x tree. I hope Unix patch files are OK; if not please let me know
what you'd prefer. I'm also writing to get a feel for how quickly this
patch is likely to be applied. :)
I work on INSPIRE ( http://
for the high-energy physics community. INSPIRE is a new, in-development
replacement for the 40-year-old SPIRES system (
http://
SPIRES, we have to try to be at least as smart as it in at least those
areas our user community actually uses. SPIRES, having 40 years of
continuous refinement, is pretty darn smart. In particular you can do
reasonably fancy things like
find date last month
or
find date march
and it will do what you expect pretty much every time.
Currently, to support parsing of dates in weird formats, we're using
python-dateutil, and we're very happy with it, but for one thing: the
parser only gives you back datetime objects, and datetime objects can't
be used to represent indefinite periods. One of my colleagues has
written a patch to give the parser a fuzzy flag which, if true, will
cause the parser to skip its default date substitutions, and instead
return a relativedelta object when dates are underspecified.
Of course, there are unit tests too.
This behavior is enormously helpful to us in for own parser, so we're
hoping you'll accept the patch.
Thanks,
Joe