Message83272
datetime is a wonderful module. Perhaps the only inconvenient aspect of
using it is dealing with month calculations and comparisons. This patch
adds a simple class, monthdelta, which represents date offsets in terms
of months. It supports basic integer-like arithmetic, and also it may
be added to dates and datetimes. It deals sensibly with leap-year and
month-length issues. Also provided is a function, monthmod (named by
imperfect analogy to divmod), which allows round-tripping: that is,
taking 2 dates and returning a (monthdelta, timedelta) tuple that
represents the interim between the dates.
Note: I have named the class "monthdelta", but in light of recent
python-dev discussions I should probably rename this to "MonthDelta". |
|
Date |
User |
Action |
Args |
2009-03-07 05:04:50 | jess.austin | set | recipients:
+ jess.austin |
2009-03-07 05:04:50 | jess.austin | set | messageid: <1236402290.49.0.02662803662.issue5434@psf.upfronthosting.co.za> |
2009-03-07 05:04:48 | jess.austin | link | issue5434 messages |
2009-03-07 05:04:47 | jess.austin | create | |
|