demos/playground/demos/calendar/calendar.js
function rendMonth(year, month) {
		var prevEnd = daysInMonth(year, month - 1),
			start = firstDayOfMonth(year, month),
			end = daysInMonth(year, month),
			// if start of month day < start of week cfg, roll back 1 wk
			wkOffs = start < wkStart ? -7 : 0;

		return el("table.month", [
			el("caption", months[month]),
			el("tr", wkdays.map(function(day) {
				return el("th", day.substr(0,3));
			})),
			range(rows).map(function(r) {
				return el("tr.week", range(cols).map(function(c) {
					var idx = (r * cols + c) + wkOffs + wkStart,
						off = idx - start + 1,
						date = year+"-"+month+"-"+off,
						cellClass = (idx < start || off > end ? ".dim" : "") + (!!api.selected[date] ? ".sel" : ""),
						cellText = idx < start ? prevEnd + off : off > end ? off - end : off;

					return el("td.day" + cellClass, {onclick: [api.selectDate, date]}, cellText);
				}));
			})
		]);
	}
function rendMonth(year, month) {
		var prevEnd = daysInMonth(year, month - 1),
			start = firstDayOfMonth(year, month),
			end = daysInMonth(year, month),
			// if start of month day < start of week cfg, roll back 1 wk
			wkOffs = start < wkStart ? -7 : 0;

		return el("table.month", [
			el("caption", months[month]),
			el("tr", wkdays.map(function(day) {
				return el("th", day.substr(0,3));
			})),
			range(rows).map(function(r) {
				return el("tr.week", range(cols).map(function(c) {
					var idx = (r * cols + c) + wkOffs + wkStart,
						off = idx - start + 1,
						date = year+"-"+month+"-"+off,
						cellClass = (idx < start || off > end ? ".dim" : "") + (!!api.selected[date] ? ".sel" : ""),
						cellText = idx < start ? prevEnd + off : off > end ? off - end : off;

					return el("td.day" + cellClass, {onclick: [api.selectDate, date]}, cellText);
				}));
			})
		]);
	}
function rendMonth ( year , month ) { var prevEnd = daysInMonth ( year , month - 1 ) , start = firstDayOfMonth ( year , month ) , end = daysInMonth ( year , month ) , // if start of month day < start of week cfg, roll back 1 wk wkOffs = start < wkStart ? - 7 : 0 ; return el ( "table.month" , [ el ( "caption" , months [ month ] ) , el ( "tr" , wkdays . map ( function ( day ) { return el ( "th" , day . substr ( 0 , 3 ) ) ; } ) ) , range ( rows ) . map ( function ( r ) { return el ( "tr.week" , range ( cols ) . map ( function ( c ) { var idx = ( r * cols + c ) + wkOffs + wkStart , off = idx - start + 1 , date = year + "-" + month + "-" + off , cellClass = ( idx < start || off > end ? ".dim" : "" ) + ( ! ! api . selected [ date ] ? ".sel" : "" ) , cellText = idx < start ? prevEnd + off : off > end ? off - end : off ; return el ( "td.day" + cellClass , { onclick : [ api . selectDate , date ] } , cellText ) ; } ) ) ; } ) ] ) ; }
sub-render
sub - render