You only add the following information about the locale configuration (local) to your jquery:
function form__date_register() {
flatpickr('.js--input--date_register', {
minDate: '1920-01-01',
locale: {
firstDayOfWeek: 1,
weekdays: {
shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
},
months: {
shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
},
},
});
}
I recommend you to place the parameters as a separate function (example flatParameters()
) in your function file js to which you can access globally. In this way you avoid repeating code because you would only call each time you use the calendar to function flatParameters()
to set in language. This way you keep the principle DRY (Do not Repeat Yourself) that allows you to maintain good programming practices.
I hope it helps. Greetings!