时间限制
spDTpickker = $('#datetimepicker_min').datepicker({ format: 'yyyy-mm-dd', language: 'zh-CN', weekStart: true, autoclose: true, todayHighlight: true, forceParse: 0, pickerPosition: "bottom-left", }).on('changeDate',function( date, vt){ var end = $('#datetimepicker_max').val()+" 23:59:59"; var mingtian = moment( end ); var xuanze = moment(date.date).format('YYYY-MM-DD 00:00:00'); var ddd = moment( xuanze ).diff(mingtian, 'seconds') if(ddd>=0){ $('#datetimepicker_min').val( moment().format('YYYY-MM-DD')) } }) epDTpickker = $('#datetimepicker_max').datepicker({ format: 'yyyy-mm-dd', language: 'zh-CN', weekStart: true, autoclose: true, todayHighlight: true, forceParse: 0, pickerPosition: "bottom-left", }).on('changeDate',function( date, vt){ var mingtian = moment().add(1, 'day').format('YYYY-MM-DD 00:00:00'); var xuanze = moment(date.date).format('YYYY-MM-DD 00:00:00'); var ddd = moment( xuanze ).diff(mingtian, 'seconds') if(ddd>=0){ $('#datetimepicker_max').val( moment().format('YYYY-MM-DD')) } var min = $('#datetimepicker_min').val()+ " 00:00:00"; var minval = moment( min ); var minshow = moment( xuanze ).diff(min, 'seconds') if( minshow<0){ $('#datetimepicker_max').val( $('#datetimepicker_min').val() ) } })
保证时间不会超出