From: Tim Wood Date: Mon, 13 Aug 2012 20:31:20 +0000 (-0700) Subject: Updating lang `L LL LLL LLLL LT` replacement to support 5 levels of recursion and... X-Git-Tag: 1.7.1~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12aad5f78251de887c465ef2362a9312a4551af8;p=thirdparty%2Fmoment.git Updating lang `L LL LLL LLLL LT` replacement to support 5 levels of recursion and stop early if it does not find a `L LL LLL LLLL LT` token --- diff --git a/moment.js b/moment.js index f0554ad1e..505439f83 100644 --- a/moment.js +++ b/moment.js @@ -372,13 +372,13 @@ // format date using native date object function formatMoment(m, format) { - var lang = getLangDefinition(m), i = 2; + var lang = getLangDefinition(m), i = 5; function getValueFromArray(key, index) { return lang[key].call ? lang[key](m, format) : lang[key][index]; } - while (i--) { + while (i-- && localFormattingTokens.test(format)) { format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); }