I'm attaching a patch to update the date tests to compare what dojo.date.add is doing to what dojo.date.difference comes up with when comparing the resulting date to the original date. With dojo.date as it is, the hour test fails on DST days because add is using the [get|set]{Property} functions. Here's some results of some tests I've run:
Input:
// not using dojo.date (showing how dojo.date.add does it internally)
var d = new Date(2007, 10, 4);
var d1 = new Date(2007, 10, 4);
d1.setHours(1)
console.debug(d);
console.debug(d1);
console.debug((d1.getTime() - d.getTime()) / 1000 / 60 / 60); // difference in hours
// using dojo.date
var d2 = dojo.date.add(d, 'hour', 1);
console.debug(d2);
console.debug(dojo.date.difference(d, d2, 'hour'));
Output:
// not using dojo.date
Sun Nov 04 2007 00:00:00 GMT-0500 (CDT)
Sun Nov 04 2007 01:00:00 GMT-0600 (CST)
2
// using dojo.date
Sun Nov 04 2007 01:00:00 GMT-0600 (CST)
2
I've also attached a patch to fix dojo.date.add for hours by using the [getUTC|setUTC]{Property} methods. Since UTC doesn't have DST, you're basically adding right to the internal milliseconds representation of the date.
Fixed in [11448] and [11449]