As we are not calling a "set" operation but an "addMonthsToDate"
operation and as a result we find this behavior surprising - and a
little non-intuitive.
Calendar does not "skip" a month when using "add" month, the days
are adjusted to the end of the next month to
git tells me CalendarUtil.java is the same in 2.7 and 2.8RC2. So yes, the
code should behave the same.
But the above behaviour is not wrong because it's standard Java behaviour.
Whether you use Date.setMonth(n) or Calendar.set(Calendar.MONTH, n) Java
behaves the same way. That is, if you start
Does this code do the same thing in 2.7?
On Wed, Aug 31, 2016 at 11:41 PM Paul Robinson wrote:
> You don't say what part of this you think is a bug. I presume it's the
> fact that Aug 31 plus one month is Oct 1. If so, this is not a bug.
>
> Adding one month should do
You don't say what part of this you think is a bug. I presume it's the fact
that Aug 31 plus one month is Oct 1. If so, this is not a bug.
Adding one month should do literally that, so you get September 31. But
there are only 30 days in September, so this automatically becomes October
1.
Paul
We have run into what looks like a date math bug for today's
date:
Here is our logged output:
[butter] Wed Aug 31 16:15:15 GMT-400 2016
Tester Date: Wed Aug 31 16:15:15 GMT-400 2016
[butter] Wed Aug 31
16:15:15 GMT-400 2016 mth: