nehakadam / AnyPicker

jQuery Picker Library for Android, iOS & Windows Phone. eg Date Picker, Time Picker, DateTime Picker, Custom Select etc
https://nehakadam.github.io/AnyPicker/
MIT License
116 stars 37 forks source link

Feb 29, 2000 is an invalid date - it never happened #22

Open birthdaybook opened 6 years ago

birthdaybook commented 6 years ago

Correction follows: added in this fact - Years divisible by 400 are NOT leap years.

_getNumberOfDaysOfMonth: function(iMonth, iYear)
{
    var apo = this;
    var iArrMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
    iArrLeapYearMonthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
    if(iYear % 4 === 0 && iYear % 400 != 0)
        return iArrLeapYearMonthDays[iMonth];
    else
        return iArrMonthDays[iMonth];
},