javascriptjquerydatetimepickerbootstrap-datetimepickereonasdan-datetimepicker

Eonasdan datetimepicker locale not working


I am experimenting with locale option of eonasdan datetimepicker but noticed a strange behavior.

Case 1:

Browser lang : en and html is

 <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>

The datetimepicker input have no issues it displays the 'ru' calendar with the date.

Case 2:

Browser lang: ru and the same html as above. The datetimepicker shows the 'ru' calendar but the input value is empty.

Does any one noticed this behavior? Ipon changing the browser lang to something other than english the picker value becomes empty.


Solution

  • Try this

    <br/>
    <div class="row">
      <div class="col-md-12">
        <h6>Datetimepicker</h6>
        <div class="form-group">
          <div class="input-group date" id="datetimepicker">
            <input type="text" class="form-control" /> <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span>
          </div>
        </div>
      </div>
    

    JavaScript

     $('#datetimepicker').datetimepicker({
        locale: 'ru',   
    });
    

    Demo on fiddle