For Calendar instances, the difference between the roll(field,amout)
and add(field,amount) operations is documented: 'roll' wraps around, while
'add' adjust the next field. For example, 'add'ing a month repeatedly should
ultimately increase the year, while 'roll' doesn't do this.
This does not work in IndianCalendar. There, 'add'ing a month may jump backward in time.
Test case:
Actual output:
Expected output: Something like
When the month is out of 0-11 range, it was adjusted to proper values only for 12. Also, the year was never readjusted in that case, which would result in year being incorrect.
Note that this problem doesn't appear in C++, as handleComputeMonthStart() in indiancal.cpp already have the code in place to take care of this:
// If the month is out of range, adjust it into range, and adjust the extended eyar accordingly
if (month < 0 || month > 11) {
eyear += (int32_t)ClockMath::floorDivide(month, 12, month);
}