From: Xotic750 Date: Mon, 16 Sep 2013 16:04:30 +0000 (+0200) Subject: Improved readability of expandFormat function X-Git-Tag: 2.3.0~32^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F1102%2Fhead;p=thirdparty%2Fmoment.git Improved readability of expandFormat function --- diff --git a/moment.js b/moment.js index 34f22fcc2..daae48e52 100644 --- a/moment.js +++ b/moment.js @@ -646,9 +646,11 @@ return lang.longDateFormat(input) || input; } - while (i-- && (localFormattingTokens.lastIndex = 0, - localFormattingTokens.test(format))) { + localFormattingTokens.lastIndex = 0; + while (i >= 0 && localFormattingTokens.test(format)) { format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); + localFormattingTokens.lastIndex = 0; + i -= 1; } return format;