Bootstrap 3 Datepicker

The bottom line: The Russian locale doesn't work. developer page

Code

<div class="container">
    <div class="row">
        <div class='col-sm-6'>
            <div class="form-group">
                <div class='input-group date' id='datetimepicker2'>
                    <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 () {
                $('#datetimepicker2').datetimepicker({
                    locale: 'ru'
                });
            });
        </script>
    </div>

But if you fix the code to

<script type="text/javascript">
    $(function () {
        $('#datetimepicker2').datetimepicker();
    });
</script>

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

Author: santer, 2015-07-31

3 answers

Check if you have the library enabled moment-with-locales.js

 4
Author: Vladimir Zhukov, 2015-07-31 15:06:47

I had the same problem. Try adding this:

$.datepicker.regional['ru'] = {
        closeText: 'Закрыть',
        prevText: '&#x3c;Пред',
        nextText: 'След&#x3e;',
        currentText: 'Сегодня',
        monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
            'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
        monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
            'Июл','Авг','Сен','Окт','Ноя','Дек'],
        dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
        dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
        dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
        dateFormat: 'dd.mm.yy',
        firstDay: 1,
        isRTL: false
    };
    $.datepicker.setDefaults($.datepicker.regional['ru']);

And then just initialize:

$("#datetimepicker2").datepicker();
 0
Author: Maks Devda, 2015-07-31 15:05:21

Also if you have the library enabled moment-with-locales.js , but still not initialized to the Russian locale, then just change the order of loading libraries. First moment.js after moment-with-locales.js

 0
Author: HELLYEAH, 2019-09-10 08:20:12