JSFiddle - React, Tailwind, and code Playground
by Sam Singer
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js"></script>
<!-- Special area for showing output -->
Hovered date: <p id="hoverDate">[Select date below]</p>
<br/><br/>
<!-- Original HTML -->
<div class="home-check-in">
<div class="search-form-group calendar">
<span class=" date-dropdown-select">
<div class="input-daterange input-group" id="datepicker2">
<input type="text" required readonly class="input-group form-control" placeholder="dd/mm/yyyy" id="FromDate" name="start" />
<span class="input-group-addon"></span>
<input type="text" required readonly class="input-group form-control" placeholder="dd/mm/yyyy" id="ToDate" name="end" />
</div>
</span>
</div>
</div>
<!-- Acknowledgment -->
<p class="acknowledgment"><b>Acknowledgment:</b> This fiddle is based on <a href="https://jsfiddle.net/9n451jcp/2/">this original Fiddle</a> by 'Mike Tracker" from StackOverflow, in response to <a href="http://stackoverflow.com/questions/35906930/bootstrap-date-range-picker-get-current-date-the-mouse-is-hovering-over">this SO thread</a> . Edited by sqsinger. Thank you!</p>
CSS
/*!
* bootstrapDP for Bootstrap v1.6.0 (https://github.com/eternicode/bootstrap-bootstrapDP)
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
.acknowledgment {
margin-top: 300px;
}
.bootstrapDP {
padding: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
direction: ltr
}
.bootstrapDP-inline {
width: 220px
}
.bootstrapDP.bootstrapDP-rtl {
direction: rtl
}
.bootstrapDP.bootstrapDP-rtl table tr td span {
float: right
}
.bootstrapDP-dropdown {
top: 0;
left: 0
}
.bootstrapDP-dropdown:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #999;
border-top: 0;
border-bottom-color: rgba(0, 0, 0, .2);
position: absolute
}
.bootstrapDP-dropdown:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-top: 0;
position: absolute
}
.bootstrapDP-dropdown.bootstrapDP-orient-left:before {
left: 6px
}
.bootstrapDP-dropdown.bootstrapDP-orient-left:after {
left: 7px
}
.bootstrapDP-dropdown.bootstrapDP-orient-right:before {
right: 6px
}
.bootstrapDP-dropdown.bootstrapDP-orient-right:after {
right: 7px
}
.bootstrapDP-dropdown.bootstrapDP-orient-bottom:before {
top: -7px
}
.bootstrapDP-dropdown.bootstrapDP-orient-bottom:after {
top: -6px
}
.bootstrapDP-dropdown.bootstrapDP-orient-top:before {
bottom: -7px;
border-bottom: 0;
border-top: 7px solid #999
}
.bootstrapDP-dropdown.bootstrapDP-orient-top:after {
bottom: -6px;
border-bottom: 0;
border-top: 6px solid #fff
}
.bootstrapDP>div {
display: none
}
.bootstrapDP table {
margin: 0;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
...
JavaScript
/*!
* bootstrapDP for Bootstrap v1.6.0 (https://github.com/eternicode/bootstrap-bootstrapDP)
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/
(function(factory) {
if (typeof define === "function" && define.amd) {
define(["jquery"], factory);
} else if (typeof exports === 'object') {
factory(require('jquery'));
} else {
factory(jQuery);
}
}(function($, undefined) {
function UTCDate() {
return new Date(Date.UTC.apply(Date, arguments));
}
function UTCToday() {
var today = new Date();
return UTCDate(today.getFullYear(), today.getMonth(), today.getDate());
}
function isUTCEquals(date1, date2) {
return (
date1.getUTCFullYear() === date2.getUTCFullYear() &&
date1.getUTCMonth() === date2.getUTCMonth() &&
date1.getUTCDate() === date2.getUTCDate()
);
}
function alias(method) {
return function() {
return this[method].apply(this, arguments);
};
}
function isValidDate(d) {
return d && !isNaN(d.getTime());
}
var DateArray = (function() {
var extras = {
get: function(i) {
return this.slice(i)[0];
},
contains: function(d) {
// Array.indexOf is not cross-browser;
// $.inArray doesn't work with Dates
var val = d && d.valueOf();
for (var i = 0, l = this.length; i < l; i++)
if (this[i].valueOf() === val)
return i;
return -1;
},
remove: function(i) {
this.splice(i, 1);
},
replace: function(new_array) {
if (!new_array)
return;
if (!$.isArray(new_array))
new_array = [new_array];
this.clear();
this.push.apply(this, new_array);
},
clear: function() {
this.length = 0;
},
copy: function() {
var a = new DateArray();
a.replace(this);
return a;
}
...