引用 bootsrtap-datatimepicker and bootstrap-datepicker 控件,發現官方控件不支持中文javascript
1,bootstrap-datepicker - 》解決方法:html
從GitHub上下載下面這個第三方的已經支持本地化的,https://github.com/eternicode/bootstrap-datepicker,java
只須要下載2個文件git
bootstrap-datepicker.jsgithub
bootstrap-datepicker.zh-CN.js便可。bootstrap
調用:插件
<script src="/assets/js/date-time/bootstrap-datepicker.js"></script>code
<script src="/assets/js/date-time/locales/bootstrap-datepicker.zh-CN.js"></script>htm
$('.date-picker').datepicker({blog
language: 'zh-CN',
autoclose: true,
todayHighlight: true
});
出處:http://blchen.com/make-bootstrap-datepicker-support-chinese/
2,bootstrap-datetimepicker - 》解決方法:
bootstrap-datetimepicker的本地化顯示依賴於moment插件。也就是說moment插件提供了多語言的內容支持,而bootstrap-datetimepicker沒有語言內容。
爲此,若是須要支持簡體中文的顯示,就須要加載中文的資源文件。
在moment的官網,下載moment+locales.js,查找到’zh-CN’部分,另存爲js文件,在moment.js和bootstrap-datetimepicker.js之間加載便可!
github:https://github.com/moment/moment
<script src=
"assets/thirdparty/bootstrap-datetimepicker/js/moment.js"
></script>
<script src=
"assets/thirdparty/bootstrap-datetimepicker/js/moment_zh-CN.js"
></script>
<script src=
"assets/thirdparty/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"
></script>
出處:http://www.myext.cn/c/a_6181.html