JQuery libraries are very useful, it helps to optimize the time, I always hear often but not always take into account web developers is that there is no need to reinvent the wheel, better to use something created and used.
In this case to fill the resource named “datepicker” that helps to add a calendar on a form in a text input, the default is coming is in English, and sometimes by tricks of the client, we transform the date into a readable and understandable language, which is why then leave the setting es-CL (Chile) for the datepicker calendar.
$('#datepicker').datepicker();
// datepicker - language espanol-chile
jQuery(function($){
$.datepicker.regional['es-cl'] = {
closeText: 'Cerrar',
prevText: 'Ant',
nextText: 'Sig',
currentText: 'Hoy',
monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
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é','Juv','Vie','Sáb'],
dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'],
weekHeader: 'Sm',
dateFormat: 'dd-mm-yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['es-cl']);
});
Until next time.