}
return _monthsParse;
}(months, monthsShort)),
+ shortMonthsParse : (function (monthsShort) {
+ var i, _shortMonthsParse = [];
+ for (i = 0; i < 12; i++) {
+ _shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i');
+ }
+ return _shortMonthsParse;
+ }(monthsShort)),
+ longMonthsParse : (function (months) {
+ var i, _longMonthsParse = [];
+ for (i = 0; i < 12; i++) {
+ _longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i');
+ }
+ return _longMonthsParse;
+ }(months)),
weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'),
weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'),
return weekdays[nounCase][m.day()];
}
+var monthsParse = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[й|я]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i];
+
export default moment.defineLocale('ru', {
months : monthsCaseReplace,
monthsShort : monthsShortCaseReplace,
weekdays : weekdaysCaseReplace,
weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
- monthsParse : [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[й|я]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i],
+ monthsParse : monthsParse,
+ longMonthsParse : monthsParse,
+ shortMonthsParse : monthsParse,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
export default moment.defineLocale('sk', {
months : months,
monthsShort : monthsShort,
- monthsParse : (function (months, monthsShort) {
- var i, _monthsParse = [];
- for (i = 0; i < 12; i++) {
- // use custom parser to solve problem with July (červenec)
- _monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i');
- }
- return _monthsParse;
- }(months, monthsShort)),
weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'),
weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'),
test('parse', function (assert) {
var tests = 'leden led_únor úno_březen bře_duben dub_květen kvě_červen čvn_červenec čvc_srpen srp_září zář_říjen říj_listopad lis_prosinec pro'.split('_'), i;
function equalTest(input, mmm, monthIndex) {
- assert.equal(moment(input, mmm).month(), monthIndex, input + ' should be month ' + (monthIndex + 1));
+ assert.equal(moment(input, mmm).month(), monthIndex, input + ' ' + mmm + ' should be month ' + (monthIndex + 1));
+ }
+ function equalTestStrict(input, mmm, monthIndex) {
+ assert.equal(moment(input, mmm, true).month(), monthIndex, input + ' ' + mmm + ' should be strict month ' + (monthIndex + 1));
}
for (i = 0; i < 12; i++) {
tests[i] = tests[i].split(' ');
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
+
+ equalTestStrict(tests[i][1], 'MMM', i);
+ equalTestStrict(tests[i][0], 'MMMM', i);
+ equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i);
+ equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i);
+ equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
+ equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
}
});
function equalTest(input, mmm, i) {
assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
}
+ function equalTestStrict(input, mmm, monthIndex) {
+ assert.equal(moment(input, mmm, true).month(), monthIndex, input + ' ' + mmm + ' should be strict month ' + (monthIndex + 1));
+ }
for (i = 0; i < 12; i++) {
tests[i] = tests[i].split(' ');
equalTest(tests[i][0], 'MMM', i);
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
+
+ equalTestStrict(tests[i][1], 'MMM', i);
+ equalTestStrict(tests[i][0], 'MMMM', i);
+ equalTestStrict(tests[i][1].toLocaleLowerCase(), 'MMM', i);
+ equalTestStrict(tests[i][1].toLocaleUpperCase(), 'MMM', i);
+ equalTestStrict(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
+ equalTestStrict(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
}
});