9aaafd7bff3ea0fc2d870b881b007b10bc2091c9
[platform/framework/web/crosswalk-tizen.git] /
1 define(['../lang/isDate', './isLeapYear'], function (isDate, isLeapYear) {
2
3     var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
4
5     /**
6      * returns the total amount of days in the month (considering leap years)
7      */
8     function totalDaysInMonth(fullYear, monthIndex){
9         if (isDate(fullYear)) {
10             monthIndex = fullYear.getMonth();
11         }
12
13         if (monthIndex === 1 && isLeapYear(fullYear)) {
14             return 29;
15         } else {
16             return DAYS_IN_MONTH[monthIndex];
17         }
18     }
19
20     return totalDaysInMonth;
21
22 });