Find JQuery DatetimePicker for PT-BR

0

Hello, I'm trying to lacalize my datetimepicker to pt-br but I'm not getting it. I tried to do it the way they teach on the official page but I could not. The plugin is working perfectly but with this problem of being in English. Other than that I'd like to know how to modify it to add the "half-hours" in it. For example, when selecting the time I have the options: 12:00, 13:00, 14:00 and so on. I've seen systems that use the same plugin and have the options: 12:00, 12:30, 13:00, 13:30 and so on. I would like to make these two changes and would be immensely grateful if anyone could help me.

Script:

<script type="text/javascript" charset="utf-8"> 

    $('.js_date_time').datetimepicker({
        format: 'd/m/Y H:i',
        lang: 'pt'
    }).setLocale('pt');
    DataTablesConfig("datatables");

</script>
    
asked by anonymous 02.08.2016 / 17:01

3 answers

1

@Guilherme, get the sample code! Bootstrap with DateTimePicker

<html>
    <head>
        <title>Bootstrap com datetimepicker</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
        <link rel="stylesheet" href="https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/build/css/bootstrap-datetimepicker.css" />
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script><scripttype="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script><scripttype="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script><scripttype="text/javascript" src="https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/src/js/bootstrap-datetimepicker.js"></script></head><body><divclass="row">
            <div class='col-sm-6' style="width:295px;">
                <div class="form-group">
                    <div class='input-group date' id='datetimepicker5'>
                        <input type='text' class="form-control"/>
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                    </div>
                </div>
            </div>
            <script type="text/javascript">
            $(function () {
                $('#datetimepicker5').datetimepicker({
                    defaultDate: "08/02/2016",
                    locale: 'pt-br'
                });
            });
            </script>
        </div>
    </body>
</html>
    
02.08.2016 / 19:42
2

Around the pt-br, I think it helps you this way:

$('.js_date_time').datetimepicker({
   dateFormat: 'dd/mm/yy',
   dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'],
   dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S', 'D'],
   dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb', 'Dom'],
   monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
   monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
   nextText: 'Proximo',
   prevText: 'Anterior'
});

I've researched a few teams that do this tuning for minutes, so I'll leave here two links of datetime . I believe that referencing the same way from the above example on the dates on the time, can be of great help.

Option 1

Option 2

obs: Both links contain lang and locale , which ends up making the above example obsolete if it is to follow one of the two, but left the example to make it clear how to create a "translation" if you have difficulties with locale / lang .

Updated:

Aiming at your script and reading a little about, the settings are quite similar to what I made available, but with minor changes. Here's the basic example of script you're using:

obs: script with parts copied to the developer site of this picker

jQuery('#datetimepicker1').datetimepicker({
 i18n:{
  de:{
   months:[
   'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto' 'Setembro', 'Outubro', 'Novembro', 'Dezembro',  
   ],
   dayOfWeek:[
    'D', 'S', 'T', 'Q', 'Q', 'S', 'S', 'D'
   ]
  }
 },
 timepicker:false,
 format:'d.m.Y'
});

In the part of setting the time in your DateTime, I checked this piece of script:

jQuery('#datetimepicker5').datetimepicker({
 datepicker:false,
 allowTimes:[
  '12:00', '13:00', '15:00', 
  '17:00', '17:05', '17:20', '19:00', '20:00'
 ]
});

obs: This example was done "manual" for "translation" to be an additional option if the lang of your script does not work correctly in your code

    
02.08.2016 / 20:20
0

Very Simple Personal

//Calendario 
$('#datetimepicker1').datetimepicker({
    format: 'DD/MM/YYYY HH:mm'
});
    
07.06.2017 / 22:25