jquerytools/jquerytools — Issue #582: Shown calendar dates outside current month and larger than max makes next arrow disabled
Author: stefannygard
Created: 2011-12-07 12:21:17+00:00
State: open

If I currently (2011) show the month November, some dates in December are also shown. If any of those December-dates are larger than max date (lets say max is set to December 6th), the next arrow will be hidden.

I have included a patch that should clearify the problem and solution.

--- jquery.tools.dateinput.js	(revision 6937)
+++ jquery.tools.dateinput.js	(working copy)
@@ -555,12 +555,16 @@
weeks.append(week);
}

+	isOff = false;
+
if (j < begin) {
+	isOff = true;
a.addClass(css.off);
num = prevDays - begin + j + 1;
date = new Date(year, month-1, num);

} else if (j >= begin + days) {
+	isOff = true;
a.addClass(css.off);
num = j - days - begin + 1;
date = new Date(year, month+1, num);
@@ -585,7 +589,8 @@
}

if (max && date > max) {
-	a.add(nm).addClass(css.disabled);
+	a.addClass(css.disabled);
+	if(!isOff) { nm.addClass(css.disabled); }
}

a.attr("href", "#" + num).text(num).data("date", date);