SerialDate.addMonths
SerialDate.addMonths
I am getting an "invalid month" exception when I try to add 2 months to a date in October. Upon investigation it looks like there is a problem with the calculation of the months in SerialDate.addMonths:
int mm = (12 * base.getYYYY() + base.getMonth() + months) % 12;
returns 0 for December when it should return 12
I would suggest the following change. instead of (x%12) the formula should read ((x-1) % 12) + 1
This way december will return 12 and not zero.
Thanks,
Peter
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact: