From: Tim Wood Date: Tue, 29 Nov 2011 17:28:41 +0000 (-0800) Subject: Trimming up bytes on isDST and isLeapYear by using moment.fn getters instead of nativ... X-Git-Tag: 1.2.0~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d164ccf9508b95a93d12dd5e077775a7b0137d8;p=thirdparty%2Fmoment.git Trimming up bytes on isDST and isLeapYear by using moment.fn getters instead of native date getters See #81 #78 --- diff --git a/moment.js b/moment.js index d6dd055d4..15c700db8 100644 --- a/moment.js +++ b/moment.js @@ -488,13 +488,12 @@ }, 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(); } }; @@ -510,7 +509,7 @@ }; } - // 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]); }