JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<input type="text" class="TinyPicker" id="startDate1">
<script>
window.tp2 = new TinyPicker({
firstBox:document.getElementById('startDate1'),
//startDate: new Date('06/16/2020'),
//endDate: new Date('07/04/2020'),
lastBox: document.getElementById('endDate1'),
months: 3,
days: ['Вс','Пн','Вт','Ср','Чт','Пт','Суб'],
local: 'ru-RU',
success: function(s, e){ alert(s + ' ' + e); },
err: function(){alert('err');}
});
window.tp2.init();
</script>
CSS
.cal {
background: white;
border: 1px solid #ccc;
position: absolute;
z-index: 1;
padding: 0;
font-size: 10px;
border-radius: 4px;
box-shadow: 0 6px 12px rgba(0,0,0,0.175);
color: black;
font-family: Arial, Helvetica, sans-serif;
}
.cal:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0,0,0,0.2);
content: '';
}
.cal:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: "";
}
.hed {
font-size: 15px;
text-align: center;
font-weight: 500;
margin: 15px 0 5px 0;
}
.inBtw {
background-color: #bbddf5;
}
.nav {
margin: 0;
}
.dHd {
text-align: center;
float: left;
width: 29.5px;
color: #bbb;
height: 30px;
line-height: 30px;
font-size: 12px;
}
.mnt {
max-width: 210px;
width: auto;
height: auto;
display: inline-block;
padding: 0 10px 10px;
}
.day {
float: left;
text-align: center;
border: none;
width: 28px;
height: 28px;
line-height: 28px;
color: #555;
cursor: pointer;
border-right: 1.5px solid white;
border-bottom: 1.5px solid white;
font-size: 14px;
}
.sel:not(.disb) {
background-color: #50a5e6;
}
.err, .err:focus {
outline: none !important;
border:1px solid red;
box-shadow: 0 0 10px red;
}
.disb {
opacity: 0.7;
color: #888;
cursor: default;
}
.rChev:before, .lChev:before {
border-style: solid;
border-width: 3px 3px 0 0;
content: "";
display: inline-block;
height: 7px;
width: 7px;
cursor: pointer;
}
.rChev:before {
transform: rotate(45deg);
}
.lChev:before {
transform:...
JavaScript
function appendChild(parent, child) {
parent.appendChild(child);
}
function getFirstElementByClass(className) {
return document.getElementsByClassName(className)[0];
}
function newDateInstance(val) {
return val ? new Date(val) : new Date();
}
function addClass(el, className) {
el.classList.add(className);
}
function getTime(date) {
return date.getTime();
}
function getNumberOfWeeks(date) {
return Math.ceil((date.getDate() - 1 - date.getDay()) / 7);
}
function removeCalendar(className) {
var element = getFirstElementByClass(className);
element && document.body.removeChild(element);
}
function isDateTodayOrFuture(currentDate, checkThisDate) {
return currentDate && checkThisDate && getTime(currentDate) >= getTime(checkThisDate);
}
function positionCalendar(calendarElement, shadowElement) {
var bodyRect = document.body.getBoundingClientRect();
var elemRect = shadowElement.getBoundingClientRect();
var offset = elemRect.top - bodyRect.top;
calendarElement.style.top = offset + elemRect.height + 15 + 'px';
calendarElement.style.left = elemRect.left + 'px';
}
function writeCSSToHead(overrideClass, styleClass) {
// Protect against double-appending the styles.
if (document.getElementsByClassName(styleClass).length) { return; }
var styleEl = document.createElement('style');
styleEl.className = styleClass;
var css = '.dHd,.day{float:left;text-align:center}.tp-cc{width:auto}.dHd,.day,.hed{pointer-events:none;text-align:center}div.cal,div.cal:after,div.cal:before,.lChev,.rChev{position:absolute}div.cal{background:#fff;max-height:310px;overflow:scroll;width:auto;border:1px solid #ccc;z-index:1;padding:0;font-size:10px;border-radius:4px;box-shadow:0 6px 12px rgba(0,0,0,.175);color:#000;font-family:Arial,Helvetica,sans-serif}div.cal:before{top:-7px;left:9px;display:inline-block;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid...