src/cal-heatmap.js
function(date, range) {
		"use strict";

		if (typeof date === "number") {
			date = new Date(date);
		}

		if (arguments.length < 2) {
			range = this.options.range;
		}

		switch(this.options.domain) {
		case "hour" :
			var domains = this.getHourDomain(date, range);

			// Case where an hour is missing, when passing from standard time to DST
			// Missing hour is perfectly acceptabl in subDomain, but not in domains
			if (typeof range === "number" && domains.length < range) {
				if (range > 0) {
					domains.push(this.getHourDomain(domains[domains.length-1], 2)[1]);
				} else {
					domains.shift(this.getHourDomain(domains[0], -2)[0]);
				}
			}
			return domains;
		case "day"  :
			return this.getDayDomain(date, range);
		case "week" :
			return this.getWeekDomain(date, range);
		case "month":
			return this.getMonthDomain(date, range);
		case "year" :
			return this.getYearDomain(date, range);
		}
	}
function(date, range) {
		"use strict";

		if (typeof date === "number") {
			date = new Date(date);
		}

		if (arguments.length < 2) {
			range = this.options.range;
		}

		switch(this.options.domain) {
		case "hour" :
			var domains = this.getHourDomain(date, range);

			// Case where an hour is missing, when passing from standard time to DST
			// Missing hour is perfectly acceptabl in subDomain, but not in domains
			if (typeof range === "number" && domains.length < range) {
				if (range > 0) {
					domains.push(this.getHourDomain(domains[domains.length-1], 2)[1]);
				} else {
					domains.shift(this.getHourDomain(domains[0], -2)[0]);
				}
			}
			return domains;
		case "day"  :
			return this.getDayDomain(date, range);
		case "week" :
			return this.getWeekDomain(date, range);
		case "month":
			return this.getMonthDomain(date, range);
		case "year" :
			return this.getYearDomain(date, range);
		}
	}
function ( date , range ) { "use strict" ; if ( typeof date === "number" ) { date = new Date ( date ) ; } if ( arguments . length < 2 ) { range = this . options . range ; } switch ( this . options . domain ) { case "hour" : var domains = this . getHourDomain ( date , range ) ; // Case where an hour is missing, when passing from standard time to DST // Missing hour is perfectly acceptabl in subDomain, but not in domains if ( typeof range === "number" && domains . length < range ) { if ( range > 0 ) { domains . push ( this . getHourDomain ( domains [ domains . length - 1 ] , 2 ) [ 1 ] ) ; } else { domains . shift ( this . getHourDomain ( domains [ 0 ] , - 2 ) [ 0 ] ) ; } } return domains ; case "day" : return this . getDayDomain ( date , range ) ; case "week" : return this . getWeekDomain ( date , range ) ; case "month" : return this . getMonthDomain ( date , range ) ; case "year" : return this . getYearDomain ( date , range ) ; } }
Get an array of domain start dates

@param  int|Date date A random date included in the wanted domain
@param  int|Date range Number of dates to get, or a stop date
@return Array of dates
Get an array of domain start dates