Home javascript Bootstrap 3 DatePicker

Bootstrap 3 DatePicker

Author

Date

Category

essence: Russian locale does not work. Developer page

code

& lt; div class = "container" & gt;
  & lt; div class = "row" & gt;
    & lt; div class = 'col-SM-6' & gt;
      & lt; div class = "Form-Group" & gt;
        & lt; div class = 'input-group date' id = 'datetimepicker2' & gt;
          & lt; Input Type = 'Text' class = "Form-Control" / & gt;
          & lt; span class = "input-group-addon" & gt;
            & lt; span class = "Glyphicon Glyphicon-Calendar" & gt; & lt; / span & gt;
          & lt; / span & gt;
        & lt; / div & gt;
      & lt; / div & gt;
    & lt; / div & gt;
    & lt; script type = "text / javascript" & gt;
      $ (Function () {
        $ ('# datetimepicker2'). DateTimepicker ({
          Locale: 'RU'
        });
      });
    & lt; / script & gt;
  & lt; / div & gt;

But if you fix the code on

& lt; script type = "text / javascript" & gt;
  $ (Function () {
    $ ('# datetimepicker2'). datetimepicker ();
  });
& lt; / script & gt;

The calendar works, but there is no Russian localization. Tell me where the jamb?


Answer 1, Authority 100%

Check if you have a library moment-with-locales.js


Answer 2

I had the same problem. Try to add this:

$. datepicker.regional ['RU'] = {
    CloseText: 'Close',
    PrevText: '& amp; # x3c; pret
    NextText: 'Next & amp; # x3e;',
    CurrentText: 'Today',
    MONTHNAMES: ['January', 'February', 'March', 'April', 'May', 'June',
      'July', 'August', 'september', 'October', 'november', 'December'],
    MonthnamessHort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
      'Jul', 'Aug', 'Saint', 'Oct', 'Noah', 'Dec'],
    DayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
    DayNamessHort: ['VSK', 'PND', 'HT', 'FRD', 'ChVT', 'PTN', 'SBT'],
    DayNamesmin: ['Sun', 'Mon', 'W', 'Wed', 'Thu', 'Pt', 'Sat'],
    DateFormat: 'dd.mm.yy',
    Firstday: 1,
    isrtl: false
  };
  $ .DatePicker.SetDefaults ($. datepicker.regional ['RU']);

and then simply initialize:

$ ("# datetimepicker2"). DatePicker ();

Answer 3

Also, if you have a moment-with-lociales.js library, but the Russian locale is not initialized anyway, then simply change the order of downloading libraries. First Moment.js After Moment-WITH-LOCALES.JS

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions