]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Trimming up bytes on isDST and isLeapYear by using moment.fn getters instead of nativ...
authorTim Wood <washwithcare@gmail.com>
Tue, 29 Nov 2011 17:28:41 +0000 (09:28 -0800)
committerTim Wood <washwithcare@gmail.com>
Tue, 29 Nov 2011 17:28:41 +0000 (09:28 -0800)
See #81 #78

moment.js

index d6dd055d40f776a173be485ae8d1c0f9d960734d..15c700db83390dd52307ca08093af108f17845bb 100644 (file)
--- a/moment.js
+++ b/moment.js
         },
 
         isLeapYear : function () {
-            var year = this._d.getFullYear();
+            var year = this.year();
             return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
         },
 
-        isDST : function() {
-            var dayOne = new Date(this._d.getFullYear(), 0, 1, 0, 0, 0);
-            return this._d.getTimezoneOffset() !== dayOne.getTimezoneOffset();
+        isDST : function () {
+            return this.zone() !== moment([this.year()]).zone();
         }
     };
 
         };
     }
 
-    // loop through and add shortcuts
+    // loop through and add shortcuts (Month, Date, Hours, Minutes, Seconds)
     for (i = 0; i < shortcuts.length; i ++) {
         makeShortcut(shortcuts[i].toLowerCase(), shortcuts[i]);
     }