]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Address some review comments immutability 3548/head
authorIskren Chernev <iskren.chernev@gmail.com>
Mon, 22 May 2017 11:20:26 +0000 (14:20 +0300)
committerIskren Chernev <iskren.chernev@gmail.com>
Mon, 22 May 2017 11:20:26 +0000 (14:20 +0300)
I added moment.isImmutable and fixed unnecessary cloning.

src/lib/units/offset.js
src/moment.js

index e29f2cae4add61fbd029e640acba3bc1c3c95401..03d3bd8e7ecb53f98cb7c7bdc17da9f4119a3d2b 100644 (file)
@@ -203,8 +203,8 @@ export function hasAlignedHourOffset (input) {
 
 export function isDaylightSavingTime () {
     return (
-        this.utcOffset() > new Moment(this).month(0).utcOffset() ||
-        this.utcOffset() > new Moment(this).month(5).utcOffset()
+        this.utcOffset() > this.month(0).utcOffset() ||
+        this.utcOffset() > this.month(5).utcOffset()
     );
 }
 
index d810e2a6a9a577c29272f620fa10006504764462..feb8cedd70737c9b01aa8280cbe5187c621d3e65 100644 (file)
@@ -7,6 +7,7 @@
 import { hooks as moment, setHookCallback } from './lib/utils/hooks';
 
 moment.version = '2.18.1';
+moment.isImmutable = true;
 
 import {
     min,