Menu

#7 'DateIsValid()' method always fails '29 Feb'

current bugs
closed-fixed
general (14)
5
2000-09-27
2000-09-26
Eric Cohn
No

The 'DateIsValid()' method always fails the 29 Feb even when the year is a leap year. eg 20 Feb 2000. The problem is with the logic at the end of the function. In particular the following code fragment:

/* check for February with leap year */
if( month == 2 && IsLeapYear( Date8 ) && day > 29 ) {
return 0;
} else if( month==2 && day>28 ) {
return 0;
}

The 'replacement' for the above that I use is show below. It appears to work well.

if (month == 2) {
if (IsLeapYear(Date8)) {
if (day > 29)
return 0;
} else {
if (day > 28)
return 0;
}
}

Discussion

  • Derry Bryson

    Derry Bryson - 2000-09-27

    This was already fixed in CVS.

     
  • Derry Bryson

    Derry Bryson - 2000-09-27
    • assigned_to: nobody --> dbryson
    • labels: 100100 --> general
    • status: open --> open-fixed
     
  • Derry Bryson

    Derry Bryson - 2000-09-27
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB