From: kostas Date: Wed, 26 Apr 2017 22:57:48 +0000 (+0300) Subject: - Fixing X-Git-Tag: 2.19.0~14^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c00cb92d4f0369626d28b48ad69d0ed1f822a5a2;p=thirdparty%2Fmoment.git - Fixing --- diff --git a/src/locale/es-do.js b/src/locale/es-do.js index 43a861476..09263c770 100644 --- a/src/locale/es-do.js +++ b/src/locale/es-do.js @@ -6,6 +6,9 @@ import moment from '../moment'; var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'), monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'); +var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i]; +var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i; + export default moment.defineLocale('es-do', { months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'), monthsShort : function (m, format) { @@ -17,7 +20,13 @@ export default moment.defineLocale('es-do', { return monthsShortDot[m.month()]; } }, - monthsParseExact : true, + monthsRegex: monthsRegex, + monthsShortRegex: monthsRegex, + monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i, + monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i, + monthsParse: monthsParse, + longMonthsParse: monthsParse, + shortMonthsParse: monthsParse, weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'), weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'), weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'), diff --git a/src/test/locale/es-do.js b/src/test/locale/es-do.js index 89454e86c..0552e3f49 100644 --- a/src/test/locale/es-do.js +++ b/src/test/locale/es-do.js @@ -211,3 +211,9 @@ test('weeks year starting sunday formatted', function (assert) { assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2º', 'Jan 15 2012 should be week 2'); }); +test('test short months proper', function (assert) { + var str = moment(new Date(2016, 7, 2)).format('DD-MMM-YYYY'); // "02-ago-2016" + assert.equal(moment(str, 'DD-MMM-YYYY').month(), '7', '02-ago-2016 month should be 7'); +}); + +