MomentJS - Nombres de meses
Puede agregar nombres de meses a la personalización de la configuración regional.
Sintaxis
moment.updateLocale('en', {
months : String[]
});
O
moment.updateLocale('en', {
months : Function
});
O
moment.updateLocale('en', {
months : {
format : String[],
standalone : String[]
}
});
Ejemplo
var localeData = moment.updateLocale('fr', {
months: [
"Jan", "Feb", "Mar", "Apr", "May", "June", "July",
"Aug", "Sept", "Oct", "Nov", "Dec"
]
});
var m = localeData.months();
Salida
Ejemplo
var localeData = moment.updateLocale('en', {
nominative:
'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
subjective:
'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
months: function (momentToFormat, format) {
if (/^MMMM/.test(format)) {
console.log(this._nominative);
return this._nominative[momentToFormat.month()];
} else {
return this._subjective[momentToFormat.month()];
}
}
});
var m = localeData.months(moment(), "MMMM");
Salida
Ejemplo
var localeData = moment.updateLocale('en', {
months : {
format:
'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
standalone:
'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
isFormat:
/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?|MMMM?(\[[^\[\]]*\]|\s+)+D[oD]?/ // from 2.14.0
}
});
var m = localeData.months();