Bootstrap Datepicker
http://stackoverflow.com/q/24981072/1093087
HTML
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker3.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>
<div id="sandbox-container">
<input type="text" class="form-control" />
</div>
JavaScript
$('#sandbox-container input').datepicker({
autoclose: false,
multidate: true
});
$('#sandbox-container input').on('show', function(e){
console.debug('show', e.date, $(this).data('stickyDate'));
if ( e.date ) {
$(this).data('stickyDate', e.date);
}
else {
$(this).data('stickyDate', null);
}
});
$('#sandbox-container input').on('hide', function(e){
console.debug('hide', e.date, $(this).data('stickyDate'));
var stickyDate = $(this).data('stickyDate');
if ( !e.date && stickyDate ) {
console.debug('restore stickyDate', stickyDate);
$(this).datepicker('setDate', stickyDate);
$(this).data('stickyDate', null);
}
});