问题
I'm looking to change the title of my JQuery DatePicker because it is displaying the wrong format for Spanish. It is saying "agosto 2015" instead of "Agosto de 2015". Is there a way I can do that?
Thanks in advance!
回答1:
One way to do this would be to use the monthNames
option in the jQuery DatePicker to change the name of each month. So for instance you would change "agosto" to "Agosto de".
Example:
$( ".selector" ).datepicker({
monthNames: [ "Enero de", "Febrero de", ... , "Diciembre de" ]
});
回答2:
You can insert de
after the month:
$(".ui-datepicker-month").after(" de");
回答3:
Download and include the language pack in your page, then make your adjustments you want, something like
datepicker.regional['es'] = {
closeText: 'Cerrar',
prevText: '<Ant',
nextText: 'Sig>',
currentText: 'Hoy',
monthNames: ['Enero de','Febrero de','Marzo de','Abril de','Mayo de','Junio de',
'Julio de','Agosto de','Septiembre de','Octubre de','Noviembre de','Diciembre de'],
monthNamesShort: ['ene','feb','mar','abr','may','jun',
'jul','ago','sep','oct','nov','dic'],
dayNames: ['domingo','lunes','martes','miércoles','jueves','viernes','sábado'],
dayNamesShort: ['dom','lun','mar','mié','jue','vie','sáb'],
dayNamesMin: ['D','L','M','X','J','V','S'],
weekHeader: 'Sm',
dateFormat: 'dd/mm/yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['es']);
来源:https://stackoverflow.com/questions/31796834/change-title-of-jquery-datepicker