layui日期自定义时分秒为当前时间


//日期自定义时分秒为当前时间
var startTime;
var now = new Date();
function time(obj){
layui.use('laydate', function(){
var laydate = layui.laydate;
startTime= laydate.render({
elem: obj,
type: 'datetime',
format: 'yyyy-MM-dd HH:mm',
theme: 'molv',
ready: function(date){
//可以自定义时分秒
this.dateTime.hours=now.getHours();
this.dateTime.minutes=now.getMinutes();
},
done: function(value, date, endDate){
startTime.config.max = {
year:date.year,
month:date.month-1,
date: date.date,
hours:this.dateTime.hours,
minutes:this.dateTime.minutes
};

}
});
});
}

 

点击确定时分秒为当前时间

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM