Skip to content

Commit

Permalink
Fix first day in calendar error / number of rows in calendar.
Browse files Browse the repository at this point in the history
When first day of month is sunday and option -use Monday as first day is set in calendar widget the month start form Monday. Problem when some month need more that 5 rows to show all days.
  • Loading branch information
tuure committed Sep 16, 2013
1 parent 7fa65f3 commit 2bcfa70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion javascript/calendar_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
this.firstDay = new Date(this.year, this.month, 1);
this.startingDay = this.firstDay.getDay();
if($.CalendarWidget.settings.startOnMonday) {
if(this.startingDay === 0) this.startingDay=6; else
this.startingDay--;
}
this.monthLength = this.settings.calDaysInMonth[this.month];
Expand Down Expand Up @@ -162,7 +163,7 @@

var cell = 1;
var empties = 0;
var row_count = Math.ceil(this.monthLength/7);
var row_count = Math.ceil((this.monthLength+this.startingDay)/7);
for (var i = 0; i < row_count; i++) {
for (var j = 0; j <= 6; j++) {
date = "";
Expand Down

0 comments on commit 2bcfa70

Please sign in to comment.