Skip to content

Commit

Permalink
fix a bug in daysInMonth function
Browse files Browse the repository at this point in the history
  • Loading branch information
arashm committed Aug 17, 2014
1 parent 2c73c54 commit 6d5c19a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions build/jdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -793,10 +793,12 @@ JDate.daysInMonth = function (year, month) {
if (month < 0) {
month += 12
year -= 1
} else if (month == 0) {
month = 12
}
if (month < 6) {
if (month <= 6) {
return 31
} else if (month < 11) {
} else if (month <= 11) {
return 30
} else if (JDate.isLeapYear(year)) {
return 30
Expand Down
2 changes: 1 addition & 1 deletion build/jdate.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions lib/jdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,12 @@ JDate.daysInMonth = function (year, month) {
if (month < 0) {
month += 12
year -= 1
} else if (month == 0) {
month = 12
}
if (month < 6) {
if (month <= 6) {
return 31
} else if (month < 11) {
} else if (month <= 11) {
return 30
} else if (JDate.isLeapYear(year)) {
return 30
Expand Down

0 comments on commit 6d5c19a

Please sign in to comment.