From: Brian Wyant Date: Sat, 9 May 2015 17:40:32 +0000 (-0400) Subject: perf: use faster form of copying dates, across the board improvement X-Git-Tag: 2.10.5~28^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de2a8fdd56bceb7ade26c141faebc019729b685b;p=thirdparty%2Fmoment.git perf: use faster form of copying dates, across the board improvement Reference: http://jsperf.com/date-copy-constructor/3 --- diff --git a/src/lib/moment/constructor.js b/src/lib/moment/constructor.js index f73559393..b29b3d7e1 100644 --- a/src/lib/moment/constructor.js +++ b/src/lib/moment/constructor.js @@ -58,7 +58,7 @@ var updateInProgress = false; // Moment prototype object export function Moment(config) { copyConfig(this, config); - this._d = new Date(+config._d); + this._d = new Date(config._d.getTime()); // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) {