Change title of JQuery DatePicker

浪子不回头ぞ 提交于 2019-12-11 02:33:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!