A simple responsive Javascript calendar with no dependencies.
CalendarJS is a more general-purpose calendar which can be employed to fit just about any use-case. There are extremely simple examples of Date pickers and event calendars provided below for reference. Note that these examples are only meant as a starting point.
<link rel='stylesheet' href="calendar.css">
<script src='calendar.js'>
<div id=calendar></div>
var ele = document.getElementById('calendar');
var opts = {abbrDay: true};
var cal = new calendar(ele, opts);
var div = document.getElementById('cal3');
var cal = new calendar(div, {
year: 2019,
month: 6,
events: [{
desc: 'Bonnaroo',
startDate: new Date(2019, 5, 13),
endDate: new Date(2019, 5, 16)
}]
});
var input = document.getElementById('date-picker');
var div = document.getElementById('cal1');
var cal = new calendar(div, {
onDayClick: function(date){
input.value = date.toLocaleDateString();
cal.clearSelection(date);
cal.selectDate(date);
div.style.display= 'none';
}
});
input.addEventListener('focus', function(){
div.style.display= 'block';
});
var startinput = document.getElementById('date-range-picker-start');
var endinput = document.getElementById('date-range-picker-end');
var div = document.getElementById('cal2');
var start_date, end_date;
var cal = new calendar(div, {
onDayClick: function(date){
if(start_date && end_date){
cal.clearSelection(date);
start_date = end_date = null;
}else if(start_date){
cal.clearSelection(date);
cal.selectDateRange(start_date, date);
end_date = date;
endinput.value = date.toLocaleDateString();
}else{
cal.selectDate(date);
start_date = date;
startinput.value = date.toLocaleDateString();
}
}
});