From: Brian Wyant Date: Wed, 22 Apr 2015 14:54:02 +0000 (-0400) Subject: perf: avoid calling new Date(+date) twice, Moment ctor will clone it properly X-Git-Tag: 2.10.3~24^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d66e3301930ddafca7ff318e99bd5c8ed9bffee;p=thirdparty%2Fmoment.git perf: avoid calling new Date(+date) twice, Moment ctor will clone it properly --- diff --git a/src/lib/create/from-anything.js b/src/lib/create/from-anything.js index 30bc1eaeb..4b836c0fa 100644 --- a/src/lib/create/from-anything.js +++ b/src/lib/create/from-anything.js @@ -34,6 +34,8 @@ function createFromConfig (config) { configFromStringAndArray(config); } else if (format) { configFromStringAndFormat(config); + } else if (isDate(input)) { + config._d = input; } else { configFromInput(config); }