简体   繁体   中英

Bootstrap 4 DateTimePicker Multidate not working

I am trying to get Bootstrap 4 DateTimePicker working allowing the selection of multiple dates. My code below works if I remove the 'multidate: true' line in the script. But when that line is there the date picker doesn't even display. Can anyone tell me what I'm doing wrong. Here's is minimal code that replicates the problem:

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- Bootstrap core JavaScript --> <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> <!-- Include Date Picker --> <script language="javascript" src="https://momentjs.com/downloads/moment.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/js/bootstrap-datetimepicker.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.43/css/bootstrap-datetimepicker.min.css"/> </head> <body> <div class="form-group "> <h5 class="border-bottom mb-4">Date Picker</h5> <div class="input-group datepicker"> <input class="form-control" id="datepicker" name=dates placeholder="yyyy-mm-dd" type="text"/> <div class="input-group-addon"> <span class="fa fa-calendar"></span> </div> </div> </div> </body> <script> $(document).ready(function() { $('.datepicker').datetimepicker({ format: "YYYY-MM-DD", multidate: true }); }); </script> </html> 

use all the links properly

 $('#datepicker').datepicker({ format: "yyyy-mm-dd", multidate: true }); 
 <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="https://uxsolutions.github.io/bootstrap-datepicker/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script> <link href="https://uxsolutions.github.io/bootstrap-datepicker/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet"/> <link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/> <div class="form-group "> <h5 class="border-bottom mb-4">Date Picker</h5> <div class="input-group datepicker"> <input class="form-control" id="datepicker" name=dates placeholder="yyyy-mm-dd" type="text"/> <div class="input-group-addon"> <span class="fa fa-calendar"></span> </div> </div> </div> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM