[TOC]
![](https://img.kancloud.cn/38/5b/385b7f2d20082158cbfa84f0bb217bdd_750x648.jpeg)
# DEMO预览:
[http://v.bootstrapmb.com/2019/6/7d6kx5198/](http://v.bootstrapmb.com/2019/6/7d6kx5198/)
# 使用方法
## 引入文件
```
<script src="../script/jquery-weui/js/rolldate.min.js"></script>
```
##视图
```
<input class="weui-input" readonly type="text" placeholder="选择时间日期" id="date-group8-1" style=" ">
```
## 脚本
```
<script>
window.onload = function() {
ea55_data_text();
}
function ea55_data_text(){
var myDate = new Date();
var tYear = myDate.getFullYear();
// 其他示例
//日期判断
new Rolldate({
el: '#date-group8-1',
format: 'YYYY-MM-DD hh:mm',
beginYear: tYear-5,
endYear: tYear+5,
confirm: function(date) {
var d = new Date(),
d1 = new Date(date.replace(/\-/g, "\/")),
d2 = new Date(d.getFullYear() + '/' + (d.getMonth() + 1) + '/' + d.getDate()); //如果非'YYYY-MM-DD'格式,需要另做调整
// if (d1 < d2) {
// alert('不能小于当前的日期');
// return false;
// }
}
});
}
</script>
```