Commits

Chris Leonello committed 9a5f648

Modified set methods of jsDate so they return jsDate instance and can be chained together.

Comments (0)

Files changed (1)

                 }
                 break;
         }
+        return this;
     };
     
     /**
      * @param {Integer} dayValue An integer from 1 to 31, representing the day of the month. 
      */
     jsDate.prototype.setDate = function(n) {
-        return this.proxy.setDate(n);
+        this.proxy.setDate(n);
+        return this;
     };
     
     /**
      * @param {Integer} dayValue Optional, between 1 and 31 representing the day of the month. If you specify the dayValue parameter, you must also specify the monthValue. 
      */
     jsDate.prototype.setFullYear = function() {
-        return this.proxy.setFullYear.apply(this.proxy, arguments);
+        this.proxy.setFullYear.apply(this.proxy, arguments);
+        return this;
     };
     
     /**
      * If you specify the msValue parameter, you must also specify the minutesValue and secondsValue. 
      */
     jsDate.prototype.setHours = function() {
-        return this.proxy.setHours.apply(this.proxy, arguments);
+        this.proxy.setHours.apply(this.proxy, arguments);
+        return this;
     };
     
     /**
      * Implements Date functionality
      */ 
     jsDate.prototype.setMilliseconds = function(n) {
-        return this.proxy.setMilliseconds(n);
+        this.proxy.setMilliseconds(n);
+        return this;
     };
     
     /**
      * Implements Date functionality
      */ 
     jsDate.prototype.setMinutes = function() {
-        return this.proxy.setMinutes.apply(this.proxy, arguments);
+        this.proxy.setMinutes.apply(this.proxy, arguments);
+        return this;
     };
     
     /**
      * Implements Date functionality
      */ 
     jsDate.prototype.setMonth = function() {
-        return this.proxy.setMonth.apply(this.proxy, arguments);
+        this.proxy.setMonth.apply(this.proxy, arguments);
+        return this;
     };
     
     /**
      * Implements Date functionality
      */ 
     jsDate.prototype.setSeconds = function() {
-        return this.proxy.setSeconds.apply(this.proxy, arguments);
+        this.proxy.setSeconds.apply(this.proxy, arguments);
+        return this;
     };
     
     /**
      * Implements Date functionality
      */ 
     jsDate.prototype.setTime = function(n) {
-        return this.proxy.setTime(n);
+        this.proxy.setTime(n);
+        return this;
     };
     
     /**
      * Implements Date functionality
      */ 
     jsDate.prototype.setYear = function() {
-        return this.proxy.setYear.apply(this.proxy, arguments);
+        this.proxy.setYear.apply(this.proxy, arguments);
+        return this;
     };
     
     /**
                 // add any years needed (increments of 12)
                 multipliers.year.add(d, Math[number > 0 ? 'floor' : 'ceil'](number / 12));
                 // ensure that we properly wrap betwen December and January
+                // 11 % 12 = 11
+                // 12 % 12 = 0
                 var prevMonth = d.getMonth() + (number % 12);
                 if (prevMonth == 12) {
                     prevMonth = 0;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.