Date.add(), Date.subtract(), & Date.truncate()
If you’ve ever worked extensively with dates in javascript, you may have missed methods like these. These methods allow you to add or subtract time from a Date object. Truncate forces your date object into a specified precision. Here’s some examples:
var d = new Date();
//=> Fri Jul 04 2008 07:48:53 GMT-0600 (MDT)
d.add( “years”, 1 );
//=> [...]