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

		if(!(dateA instanceof Date)) {
			dateA = new Date(dateA);
		}

		if (!(dateB instanceof Date)) {
			dateB = new Date(dateB);
		}


		function normalizedMillis(date, subdomain) {
			switch(subdomain) {
			case "x_min":
			case "min":
				return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes()).getTime();
			case "x_hour":
			case "hour":
				return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours()).getTime();
			case "x_day":
			case "day":
				return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
			case "x_week":
			case "week":
			case "x_month":
			case "month":
				return new Date(date.getFullYear(), date.getMonth()).getTime();
			default:
				return date.getTime();
			}
		}

		return normalizedMillis(dateA, this.options.subDomain) < normalizedMillis(dateB, this.options.subDomain);
	}
function(dateA, dateB) {
		"use strict";

		if(!(dateA instanceof Date)) {
			dateA = new Date(dateA);
		}

		if (!(dateB instanceof Date)) {
			dateB = new Date(dateB);
		}


		function normalizedMillis(date, subdomain) {
			switch(subdomain) {
			case "x_min":
			case "min":
				return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes()).getTime();
			case "x_hour":
			case "hour":
				return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours()).getTime();
			case "x_day":
			case "day":
				return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
			case "x_week":
			case "week":
			case "x_month":
			case "month":
				return new Date(date.getFullYear(), date.getMonth()).getTime();
			default:
				return date.getTime();
			}
		}

		return normalizedMillis(dateA, this.options.subDomain) < normalizedMillis(dateB, this.options.subDomain);
	}
function ( dateA , dateB ) { "use strict" ; if ( ! ( dateA instanceof Date ) ) { dateA = new Date ( dateA ) ; } if ( ! ( dateB instanceof Date ) ) { dateB = new Date ( dateB ) ; } function normalizedMillis ( date , subdomain ) { switch ( subdomain ) { case "x_min" : case "min" : return new Date ( date . getFullYear ( ) , date . getMonth ( ) , date . getDate ( ) , date . getHours ( ) , date . getMinutes ( ) ) . getTime ( ) ; case "x_hour" : case "hour" : return new Date ( date . getFullYear ( ) , date . getMonth ( ) , date . getDate ( ) , date . getHours ( ) ) . getTime ( ) ; case "x_day" : case "day" : return new Date ( date . getFullYear ( ) , date . getMonth ( ) , date . getDate ( ) ) . getTime ( ) ; case "x_week" : case "week" : case "x_month" : case "month" : return new Date ( date . getFullYear ( ) , date . getMonth ( ) ) . getTime ( ) ; default : return date . getTime ( ) ; } } return normalizedMillis ( dateA , this . options . subDomain ) < normalizedMillis ( dateB , this . options . subDomain ) ; }
Returns wether or not dateA is less than or equal to dateB. This function is subdomain aware.
Performs automatic conversion of values.
@param dateA may be a number or a Date
@param dateB may be a number or a Date
@returns {boolean}
Returns wether or not dateA is less than or equal to dateB . This function is subdomain aware . Performs automatic conversion of values .