Hi all,

Just spent about an hour figuring out what the hell was going on with
dateutil comparisons, and thought I'd share with the group.

Essentially, when trying to compare relativedelta to each other, we were
getting very strange results.

In the end, it was due to the fact 'calendar' needed to be imported -
without this, it seems to do strange things.

Hope this is useful to something else in the future - as we use dateutil
heavily in all our webapps, and this is the first time I'd ever come across
this.

Cal

----------------

Proof of concept:

>>> from dateutil.relativedelta import *
>>> relativedelta(years=+2) > relativedelta(days=+7)
True
>>> import datetime
>>> relativedelta(years=+2) > relativedelta(days=+7)
False
>>> import calendar
>>> relativedelta(years=+2) > relativedelta(days=+7)
True
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to