On 2014-04-02, at 15:04 , Skip Montanaro
On Wed, Apr 2, 2014 at 7:52 AM, M.-A. Lemburg
wrote: print now() + RelativeDateTime(months=+1, day=1) 2014-05-01 14:49:05.83
I find this sort date arithmetic unintuitive, though I'm at a loss to come up with better logic than you have:
d = Date(2014, 2, 28) d + RelativeDateTime(months=+1)
d = Date(2014, 1, 31) d + RelativeDateTime(months=+1) I guess the assumption is that one month is the length in days of the current month, though, you wind up with situations where shorter months can be skipped altogether. Is there a way to talk in terms of "months" but not have short months get skipped?
FWIW dateutil has a slightly different logic there:
date(2014, 2, 28) + relativedelta(months=+1) datetime.date(2014, 3, 28) date(2014, 1, 31) + relativedelta(months=+1) datetime.date(2014, 2, 28)