[New-bugs-announce] [issue5434] datetime.MonthDelta

Jess Austin report at bugs.python.org
Sat Mar 7 06:04:50 CET 2009

New submission from Jess Austin <jess.austin at gmail.com>:

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".

components: Library (Lib)
messages: 83272
nosy: jess.austin
severity: normal
status: open
title: datetime.MonthDelta
type: feature request
versions: Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list