]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Exclude dot from Dutch month abbreviations when surrounded by dashes. 346/head
authorNiels Beekman <cgbeekman@gmail.com>
Wed, 20 Jun 2012 21:42:03 +0000 (23:42 +0200)
committerNiels Beekman <cgbeekman@gmail.com>
Wed, 20 Jun 2012 21:42:03 +0000 (23:42 +0200)
lang/nl.js
test/lang/nl.js

index 99422d7e3b202e354f6f46fd75ed342065dbf845..53deafb80880e7bae2c3a84af506d338e1ee68de 100644 (file)
@@ -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("_"),
index 50f412d1ec51c380fb137d7761ac64f7ec132bf9..6d6525501d0c9d9cd023a45935e8faf30cd9dcb7 100644 (file)
@@ -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();
     }
 };