en datepicker does not work in Adminlte 2

Asked

Viewed 192 times

1

Hello, I’m developing a panel and I need the datepicker in Portuguese, I tried to modify the js file itself but the dates disappeared.

$('#datepicker').datepicker({
        autoclose: true,
        language:'pt-BR',
        format: {
            /*
             * Say our UI should display a week ahead,
             * but textbox should store the actual date.
             * This is useful if we need UI to select local dates,
             * but store in UTC
             */
            toDisplay: function (date, format, language) {
                var language ='pt-BR';
                var data = new Date(date);
                var dia = date.getDate()+1;
                console.log(dia);
                if (dia.toString().length == 1)
                  dia = "0"+dia;
                var mes = data.getMonth()+1;
                if (mes.toString().length == 1)
                  mes = "0"+mes;
                var ano = data.getFullYear();
                //console.log(moment().format('mm'));
                console.log(language);  
                return dia+"/"+mes+"/"+ano;

            },
            toValue: function (date, format, language) {
                var d = new Date(date);
                d.setDate(d.getDate() + 7);
                // console.log(new Date(d));
                return new Date(d);
            }
        }




    });
  });
  • 1

    So that this format? Try it like this: $('#datepicker').datepicker({
 format: "dd/mm/yyyy",
 startView: 2,
 language: "pt-BR" 
 });

  • He took the amount from the day before.

  • Ficou em português?

  • I now had the choice of year and month but did not translate. @Jorgematheus

  • I found the bug @Jorgematheus, the minified version was set to 'en' so prioritized this config Linkei ai managed to define in the script call.

  • show, glad you solved!

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.