months : function (momentToFormat, format) {
if (!momentToFormat) {
return this._monthsNominativeEl;
- } else if (/D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM'
+ } else if (typeof format === 'string' && /D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM'
return this._monthsGenitiveEl[momentToFormat.month()];
} else {
return this._monthsNominativeEl[momentToFormat.month()];
assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2η', 'Jan 15 2012 should be week 2');
});
+test('localeData months calls', function (assert) {
+ var jan = moment('2012-01-01');
+ assert.equal(moment.localeData().months(jan), 'Ιανουάριος', 'should return the nominative month name');
+ assert.equal(moment.localeData().months(jan, 'D MMMM'), 'Ιανουαρίου', 'should return the genitive month name');
+});