zoukankan      html  css  js  c++  java
  • easyUI时间控件 使用

    1,时间格式化,分隔符为     “—”

    // 日期格式化
    function myformatter(date){
    	var y = date.getFullYear();
    	var m = date.getMonth()+1;
    	var d = date.getDate();
    	return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
    };
    function myparser(s){
    	var t = Date.parse(s);
    	if (!isNaN(t)){
    		return new Date(t);
    	} else {
    		return new Date();
    	}
    };
    

     2,两个日历框,限定后面的时间大于等于前面的时间,今天之前的时间不能选

    // 将今天之前的日期disabled
    // 在离店日历中将入住时间之前的时间都disable
    $(function(){
    	$('#date_check').datebox('calendar').calendar({
            validator : function(date){
                var now = new Date();
                var checkTime = new Date(now.getFullYear(), now.getMonth(), now.getDate());
                return checkTime <= date;
            },
            onChange: function(leftTime){
            	$('#date_leave').datebox('calendar').calendar({
            		validator : function(date){
            			return leftTime <= date;
            		}
            	});
            }
    	});
    })
    

      

  • 相关阅读:
    203. Remove Linked List Elements
    python练习小程序
    五十音练习小软件
    CocosCreator生命游戏
    一个swift下载程序
    用excel做一幅像素画
    翻译一篇SpiderMonkey GC的文章
    unity-3d拼图游戏
    NDK编译Python2.7.5
    git命令简图
  • 原文地址:https://www.cnblogs.com/lal-fighting/p/5788173.html
Copyright © 2011-2022 走看看