JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/picnicss/6.2.4/picnic.min.css">
<script src="https://npmcdn.com/flatpickr"></script>
<link rel="stylesheet" href="https://npmcdn.com/flatpickr/dist/themes/material_blue.css">
<input type="text" id="flatpickr1" class="flatpickr">
<input type="text" id="flatpickr2" class="flatpickr">
<input type="text" id="flatpickr3" class="flatpickr">
<input type="text" id="flatpickr4" class="flatpickr">
CSS
body {
background:#F3F5F6
}
.date {
float: left;
width: 45px;
text-align: center;
z-index: 1;
position: relative;
height: 40px;
line-height: 40px;
color: #d0d0d0;
}
.cont {
padding: 40px;
background: white;
margin: 50px;
width: 530px;
height: 120px;
}
.busy {
width: 100%;
height: 100%;
position: absolute;
top: 0;
z-index: -1;
}
JavaScript
var inMonthSync = 0;
var calendars = Array();
function syncMonths(selectedDates, inputValue, self, data) {
if (inMonthSync)
return;
var scroll = document.documentElement.scrollTop;
inMonthSync = 1;
calendars.forEach(function(calendar) {
calendar.currentYear = self.currentYear;
calendar.changeMonth(self.currentMonth, false);
console.log(calendar);
});
inMonthSync = 0;
window.scrollTo(0, scroll);
}
document.querySelectorAll('.flatpickr').forEach(function(element) {
let calendar = new Flatpickr(element, {
inline: true,
onMonthChange: syncMonths,
onYearChange: syncMonths
});
calendars.push(calendar);
});