From: Niels Beekman Date: Wed, 20 Jun 2012 21:42:03 +0000 (+0200) Subject: Exclude dot from Dutch month abbreviations when surrounded by dashes. X-Git-Tag: 1.7.0~14^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F346%2Fhead;p=thirdparty%2Fmoment.git Exclude dot from Dutch month abbreviations when surrounded by dashes. --- diff --git a/lang/nl.js b/lang/nl.js index 99422d7e3..53deafb80 100644 --- a/lang/nl.js +++ b/lang/nl.js @@ -2,9 +2,17 @@ // language : dutch (nl) // author : Joris Röling : https://github.com/jjupiter (function () { + var monthsShortWithDots = "jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"); + var monthsShortWithoutDots = "jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"); var lang = { months : "januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"), - monthsShort : "jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"), + monthsShort : function (m, format) { + if (/-MMM-/.test(format)) { + return monthsShortWithoutDots[m.month()]; + } else { + return monthsShortWithDots[m.month()]; + } + }, weekdays : "zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"), weekdaysShort : "zo._ma._di._wo._do._vr._za.".split("_"), weekdaysMin : "Zo_Ma_Di_Wo_Do_Vr_Za".split("_"), diff --git a/test/lang/nl.js b/test/lang/nl.js index 50f412d1e..6d6525501 100644 --- a/test/lang/nl.js +++ b/test/lang/nl.js @@ -244,5 +244,15 @@ exports["lang:nl"] = { test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago"); test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks"); test.done(); + }, + + "month abbreviation" : function(test) { + test.expect(2); + moment.lang('nl'); + + test.equal(moment([2012, 5, 23]).format('D-MMM-YYYY'), '23-jun-2012', 'format month abbreviation surrounded by dashes should not include a dot'); + test.equal(moment([2012, 5, 23]).format('D MMM YYYY'), '23 jun. 2012', 'format month abbreviation not surrounded by dashes should include a dot'); + + test.done(); } };