Bootstrap - datepicker - how to pick US Locale settings

时间:2015-09-14 15:52:08

标签: jquery twitter-bootstrap-3 bootstrap-datetimepicker

I am using date picker (http://eonasdan.github.io/bootstrap-datetimepicker/FAQ/#how-do-i-change-the-languagelocale) and I am struggling to use locale calendar for US. I could get GB working.

Apart from jQuery I attach the following

    <link rel="stylesheet" href="css/bootstrap-datetimepicker.css">
<script src="js/moment.min.js"></script>
<script src="js/en-gb.js"></script>
<script src="js/bootstrap-datetimepicker.min.js"></script>

Below are the calendar object

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

<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: 'en-gb'
            });
        });
    </script>
</div>

I wonder how can i get US calendar working (without using moment-with-locales.min.js which is a huge file!)

1 个答案:

答案 0 :(得分:1)

不要包含js/en-gb.js并且不要指定区域设置,就像使用datepicker1一样。将区域设置指定为&#39; en-us&#39;我认为也可以。