码迷,mamicode.com
首页 > 其他好文 > 详细

时间日期日历控件(bootstrap-datetimepicker)

时间:2020-05-26 18:06:49      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:tom   false   time   view   tar   javascrip   toc   picker   parse   

1、引入jar

  <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://cdn.bootcss.com/moment.js/2.24.0/moment-with-locales.js"></script>
   <script src="https://cdn.bootcss.com/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>

 

2、改写js

$(function() {
	$(".startdate").datetimepicker({
		language:  i18n_lang,
		weekStart: 1,
        todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: 1,
	    format:‘yyyy-mm-dd‘
	}).on(‘changeDate‘, function (ev) {  
        $(".enddate").datetimepicker(‘setStartDate‘, this.value);  
    });
	
	$(".enddate").datetimepicker({
		language:  i18n_lang,
		weekStart: 1,
        todayBtn:  1,
		autoclose: 1,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: 1,
		format:‘yyyy-mm-dd‘
	}).on(‘changeDate‘, function (ev) {  
        $(".startdate").datetimepicker(‘setEndDate‘, this.value);  
    });
	
	$(‘.form_datetime‘).datetimepicker({
		language:  i18n_lang,
		todayHighlight: 1,
		startView: 2,
		forceParse: false,
		showMeridian: true,
		autoclose: true,
		todayBtn: true,
		pickerPosition: "bottom-left"
	});	
	$(‘.form_date‘).datetimepicker({
		language:  i18n_lang,
		todayHighlight: 1,
		startView: 2,
		minView: 2,
		forceParse: false,
		autoclose: true,
		todayBtn: true,
		pickerPosition: "bottom-left"
	});	

	$(‘.form_year‘).datetimepicker({
	    language:  i18n_lang,
	    startView: 4,
	    minView: 4,
	    format: "yyyy",
	    todayHighlight:true,
	    forceParse:false,
	    autoclose:true,
	    todayBtn: true,
	    pickerPosition: "bottom-left"
	});
});

  

时间日期日历控件(bootstrap-datetimepicker)

标签:tom   false   time   view   tar   javascrip   toc   picker   parse   

原文地址:https://www.cnblogs.com/123-shen/p/12966780.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!