Last active
June 22, 2022 17:01
-
-
Save natanverdes/31b1879b4ec85b076ab5 to your computer and use it in GitHub Desktop.
Código para configurar JQuery DatePicker en Español
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------- DEFINICIÓN DE IDIOMA ---------------------- | |
// Recurso original: | |
// http://reviblog.net/2014/01/07/jquery-ui-datepicker-poner-el-calendario-en-espanol-euskera-o-cualquier-otro-idioma/ | |
$.datepicker.regional['es'] = { | |
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']); | |
// ----------------- CREACIÓN DE DATEPICKER DE PRUEBA---------------------- | |
$(function() { | |
$("#nuestrodatepicker").datepicker(); | |
} | |
// ----------------- DEFINICIÓN DE FORMATO ---------------------- | |
// Recurso original: | |
// http://www.backtheweb.com/jquery/como-dar-formato-a-la-fecha-del-datepicker-de-jquery/ | |
$(function() { | |
$('#nuestrodatepicker').datepicker('option', {dateFormat: 'dd/mm/yy'}); | |
}); |
Esto quedó deprecado:
Debería ser
$.fn.datepicker.dates['es'] = {
days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"],
daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sá"],
months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
today: "Hoy",
clear: "Borrar",
format: "dd/mm/yyyy",
titleFormat: "MM yyyy", /* Leverages same syntax as 'format' */
weekStart: 0
};
$.fn.datepicker.dates['es'] = {
days: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
daysShort: ["Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"],
daysMin: ["Do", "Lu", "Ma", "Mi", "Ju", "Vi", "Sá"],
months: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
monthsShort: ["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"],
today: "Hoy",
clear: "Borrar",
format: "dd/mm/yyyy",
titleFormat: "MM yyyy", /* Leverages same syntax as 'format' */
weekStart: 0
};
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mu buen aporte