From: Jordan Sexton Date: Wed, 30 Jul 2014 05:46:31 +0000 (-0500) Subject: Allowing moment.set() to accept a hash of units X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67c9506;p=thirdparty%2Fmoment.git Allowing moment.set() to accept a hash of units --- diff --git a/moment.js b/moment.js index 79b1e8b1c..e64ef0f67 100644 --- a/moment.js +++ b/moment.js @@ -2396,9 +2396,17 @@ }, set : function (units, value) { - units = normalizeUnits(units); - if (typeof this[units] === 'function') { - this[units](value); + var unit; + if (typeof units === 'object') { + for (unit in units) { + this.set(unit, units[unit]); + } + } + else { + units = normalizeUnits(units); + if (typeof this[units] === 'function') { + this[units](value); + } } return this; },