]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
fix zero index for months() and weekdays() 1171/head
authorIsaac Cambron <isaac@isaaccambron.com>
Tue, 8 Oct 2013 03:53:01 +0000 (23:53 -0400)
committerIsaac Cambron <isaac@isaaccambron.com>
Tue, 8 Oct 2013 03:53:01 +0000 (23:53 -0400)
moment.js
test/moment/listers.js

index e62b5d5023c4fdb4a99202e9ec073afa927bc6e0..0bc3a20e99636f6e9d476c6467a36a8160bc2659 100644 (file)
--- a/moment.js
+++ b/moment.js
                 return method.call(moment.fn._lang, m, format || '');
             };
 
-            if (index) {
+            if (index != null) {
                 return getter(index);
             }
             else {
index 7f9021b4a06b40da9844a1ad5e9467f716464246..86fbbd2d2045138d63f9b655bf31432f7e00c7aa 100644 (file)
@@ -22,11 +22,15 @@ exports.listers = {
     },
 
     "index" : function (test) {
-        test.expect(5);
+        test.equal(moment.months(0), "January");
         test.equal(moment.months(2), "March");
+        test.equal(moment.monthsShort(0), "Jan");
         test.equal(moment.monthsShort(2), "Mar");
+        test.equal(moment.weekdays(0), "Sunday");
         test.equal(moment.weekdays(2), "Tuesday");
+        test.equal(moment.weekdaysShort(0), "Sun");
         test.equal(moment.weekdaysShort(2), "Tue");
+        test.equal(moment.weekdaysMin(0), "Su");
         test.equal(moment.weekdaysMin(2), "Tu");
         test.done();
     },
@@ -46,13 +50,18 @@ exports.listers = {
             weekdaysMin: weekdaysMin
         });
 
-        test.expect(10);
         test.deepEqual(moment.months(), months);
         test.deepEqual(moment.monthsShort(), monthsShort);
         test.deepEqual(moment.weekdays(), weekdays);
         test.deepEqual(moment.weekdaysShort(), weekdaysShort);
         test.deepEqual(moment.weekdaysMin(), weekdaysMin);
 
+        test.equal(moment.months(0), "one");
+        test.equal(moment.monthsShort(0), "on");
+        test.equal(moment.weekdays(0), "one");
+        test.equal(moment.weekdaysShort(0), "on");
+        test.equal(moment.weekdaysMin(0), "1");
+
         test.equal(moment.months(2), "three");
         test.equal(moment.monthsShort(2), "th");
         test.equal(moment.weekdays(2), "three");