examples/requirejs/scripts/nools.js
function (/*Date*/date1, /*Date?*/date2, /*String*/interval, utc) {
                date2 = date2 || new Date();
                interval = interval || "day";
                return differenceTransform(interval, date1, date2, utc);
            }
function (/*Date*/date1, /*Date?*/date2, /*String*/interval, utc) {
                date2 = date2 || new Date();
                interval = interval || "day";
                return differenceTransform(interval, date1, date2, utc);
            }
function ( /*Date*/ date1 , /*Date?*/ date2 , /*String*/ interval , utc ) { date2 = date2 || new Date ( ) ; interval = interval || "day" ; return differenceTransform ( interval , date1 , date2 , utc ) ; }
Finds the difference between two dates based on the specified interval

@example

var dtA, dtB;

dtA = new Date(2005, 11, 27);
dtB = new Date(2006, 11, 27);
dateExtender.difference(dtA, dtB, "year"); //1

dtA = new Date(2000, 1, 29);
dtB = new Date(2001, 2, 1);
dateExtender.difference(dtA, dtB, "quarter"); //4
dateExtender.difference(dtA, dtB, "month"); //13

dtA = new Date(2000, 1, 1);
dtB = new Date(2000, 1, 8);
dateExtender.difference(dtA, dtB, "week"); //1

dtA = new Date(2000, 1, 29);
dtB = new Date(2000, 2, 1);
dateExtender.difference(dtA, dtB, "day"); //1

dtA = new Date(2006, 7, 3);
dtB = new Date(2006, 7, 11);
dateExtender.difference(dtA, dtB, "weekday"); //6

dtA = new Date(2000, 11, 31, 23);
dtB = new Date(2001, 0, 1, 0);
dateExtender.difference(dtA, dtB, "hour"); //1

dtA = new Date(2000, 11, 31, 23, 59);
dtB = new Date(2001, 0, 1, 0, 0);
dateExtender.difference(dtA, dtB, "minute"); //1

dtA = new Date(2000, 11, 31, 23, 59, 59);
dtB = new Date(2001, 0, 1, 0, 0, 0);
dateExtender.difference(dtA, dtB, "second"); //1

dtA = new Date(2000, 11, 31, 23, 59, 59, 999);
dtB = new Date(2001, 0, 1, 0, 0, 0, 0);
dateExtender.difference(dtA, dtB, "millisecond"); //1


@param {Date} date1
@param {Date} [date2 = new Date()]
@param {String} [interval = "day"] the intercal to find the difference of.
<ul>
<li>day | days</li>
<li>weekday | weekdays</li>
<li>year | years</li>
<li>week | weeks</li>
<li>quarter | quarters</li>
<li>months | months</li>
<li>hour | hours</li>
<li>minute | minutes</li>
<li>second | seconds</li>
<li>millisecond | milliseconds</li>
</ul>
Finds the difference between two dates based on the specified interval