Page 1 of 1

Bug

Posted: Thu May 07, 2009 10:01 am
by jfreebob
I think I've found a pretty major bug in the 'private int calcSerial(final int d, final int m, final int y)' function of the SpreadsheetDate class in the jcommon library.

if (m > MonthConstants.FEBRUARY) {

should be replaced with either:

if (m >= MonthConstants.FEBRUARY) {

or

if (m > 1) {

Maybe something like this:

public static int calcSerial(final int d, final int m, final int y)
{
final int yy = ((y - 1900) * 365) + SerialDate.leapYearCount(y - 1);
int mm = AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH[m];
if (m > 1 && SerialDate.isLeapYear(y))
return yy + mm + d + 2;
return yy + mm + d + 1;
}

Cheers, Bob

Re: Bug

Posted: Fri May 22, 2009 2:45 am
by david.gilbert
I don't think this is a bug - see my comments on the bug report:

https://sourceforge.net/tracker/?func=d ... tid=115494