laydate日期范围控制
2024-09-30 23:02:27
1.html
<input type="text" id="startTime" name="startTime" class="form-control" placeholder="开始时间">
<input type="text" id="endTime" name="endTime" class="form-control" placeholder="结束时间">
2.laydate的使用,控制开始日期的最大日期为当前日期。结束时间的范围为开始时间到当前日期。
//laydate日期
var startDate = laydate.render({
elem: '#startTime', //指定元素
type: 'datetime',
max:getNowFormatDate(),
done: function (value, dates) {
endDate.config.min ={
year:dates.year,
month:dates.month-1, //关键
date: dates.date,
hours: 0,
minutes: 0,
seconds : 0
};
}
});
var endDate = laydate.render({
elem: '#endTime', //指定元素
type: 'datetime',
max:getNowFormatDate()
});
//获取当前的日期时间 格式“yyyy-MM-dd HH:MM:SS”
function getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
var seperator2 = ":";
var month = date.getMonth() + 1;
var strDate = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (strDate >= 0 && strDate <= 9) {
strDate = "0" + strDate;
}
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
+ " " + date.getHours() + seperator2 + date.getMinutes()
+ seperator2 + date.getSeconds();
return currentdate;
}
最新文章
- nmon工具的安装及简单使用
- SharePoint 2013 搭建负载均衡(NLB)
- HTML5实践 -- 使用CSS3 Media Queries实现响应式设计
- JS中插入节点的方法appendChild和insertBefore的应用
- C#委托实例
- jQuery.isNumeric() 和 js isNaN()
- 解决JQuery中datatables设置隐藏显示列多次提交后台刷新数据的问题
- Hello ReactJS
- 在 WebSphere Application Server V7 集群环境中管理 HTTP session[阅读]
- C陷阱和缺陷学习笔记
- 阿里云服务器Linux CentOS安装配置(11)安装Wordpress
- SQL Server实现读写分离提高系统并发
- web项目中添加MySQL驱动
- Docker技术入门与实战 第二版-学习笔记-6-仓库
- POJ 3666 Making the Grade(二维DP)
- List,Set的区别
- redhat 7.2更新yum源时踩的坑
- Linux将程序添加到服务的方法(通用)
- [Agc001E] BBQ Hard
- ElasticSearch基本查询
热门文章
- 在虚拟机安装Oracle,在本地电脑上运行sql develer出现ora-12514
- C语言提高 (7) 第七天 回调函数 预处理函数DEBUG 动态链接库
- 记Spring搭建功能完整的个人博客「Oyster」全过程[其一] 整体思路:需求、架构及技术要求
- NOI 2016 循环之美 (莫比乌斯反演+杜教筛)
- python中的各个包的安装,用pip安装whl文件
- gem update --system
- linux下測试硬盘读写速度
- Struts2值栈的相关操作
- Beginning Python From Novice to Professional (9) - Socket
- Swift3.0 闭包整理