|
This is Issue #5434, http://bugs.python.org/issue5434, on the python tracker. This patch adds a monthdelta class to the datetime module, 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: The "monthdelta" class will retain its lowercased name; see discussion at rejected Issue 5530.
|