2017-04-20 87 views

回答

1

引導eonasdan-的DateTimePicker依靠momentjs,它使用力矩,獲得當週的日子本地化的名稱(請參見源fillDow功能:它使用currentDate.format('dd')獲得星期幾的簡稱通過時刻format )。

Moment允許您使用updateLocaleweekdaysMin鍵來定製本地化短名稱,如文檔的定製 - >Minimal Weekday Abbreviations部分中所述。

這裏一個完整的工作示例:

moment.updateLocale('en', { 
 
    weekdaysMin : ["S", "M", "T", "W", "T", "F", "S"] 
 
}); 
 
$('#datetimepicker1').datetimepicker();
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet"/> 
 
<link href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.45/css/bootstrap-datetimepicker.css" rel="stylesheet"/> 
 

 
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script> 
 
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script> 
 
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script> 
 
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.45/js/bootstrap-datetimepicker.min.js"></script> 
 

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

相關問題