0

I have this code that I use to select 2 date in jquery

 <script>

  $(function() {
  $.datepicker.setDefaults({minDate: new Date()});
  $('#from').datepicker({onSelect: function(selectedDate) {
        var date = $(this).datepicker('getDate');
        if (date) {
              date.setDate(date.getDate() + 1);
        }
        $('#to').datepicker('option', 'minDate', date);
  }});
  $('#to').datepicker({onSelect: function(selectedDate) {
        var date = $(this).datepicker('getDate');
        if (date) {
              date.setDate(date.getDate() - 1);
        }
        $('#from').datepicker('option', 'maxDate', date);
  }});

   });
    </script>

I'd like to insert

          $.datepicker.regional['it'];

Where I can put in my code? I must do a website in several language so I must change a lot of time the localization code

Vignesh Raja
  • 7,927
  • 1
  • 33
  • 42

1 Answers1

0

You have to load the specific localization file. You can get them from here. Example below.

Source : Stackoverflow answers

$( "#datepicker" ).datepicker( $.datepicker.regional[ "fr" ] );
<link href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet"/>
<link href="https://jqueryui.com/jquery-wp-content/themes/jqueryui.com/style.css" rel="stylesheet"/>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://jqueryui.com/resources/demos/datepicker/i18n/datepicker-fr.js"></script>
<input id="datepicker">
Vignesh Raja
  • 7,927
  • 1
  • 33
  • 42