-2

I have the following JQuery script:

<script>
$( function() {
  $( "#datepicker1" ).datepicker({ dateFormat: 'd MM y' });
});
$( function() {
  $( "#datepicker2" ).datepicker({ dateFormat: 'd MM y' });
});
</script>

This script connects with the following html code:

<label for="datepicker1">Fecha 1</label>
<input type="text" id="datepicker1" class="form-control input-sm">
<label for="datepicker2">Fecha 2</label>
<input type="text" id="datepicker2" class="form-control input-sm">

And this prints the following datepicker in the application

What I want to do is change the language of the result by choosing the date in the datepicker, that is, instead of indicating "14 June 2020", which index "14 Junio 2020" and if possible be "14 de Junio de 2020".

I hope I have explained myself well, it is the first time that I use this platform.

SERGIO TC
  • 1
  • 2

1 Answers1

1

You need to make use of their localize functionality as described in their documentation that you can find here.

Example:

$( function() {
    $( "#datepicker" ).datepicker( $.datepicker.regional[ "es" ] );
    $( "#locale" ).on( "change", function() {
      $( "#datepicker" ).datepicker( "option",
        $.datepicker.regional[ $( this ).val() ] );
    });
 });
Martin
  • 2,326
  • 1
  • 12
  • 22