JavaScript calendar

A lightweight responsive JavaScript calendar, date and date-time picker web component plugin. It brings a great user experience across different devices.


Date picker webcomponent plugin



<html>
<script src="https://jsuites.net/v4/jsuites.js"></script>
<script src="https://jsuites.net/v4/jsuites.webcomponents.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" />

<jsuites-calendar value="2020-01-20"></jsuites-calendar>

<script>
document.querySelector('jsuites-calendar').addEventListener('onchange', function(e) {
    console.log('New value: ' + e.target.value);
});
document.querySelector('jsuites-calendar').addEventListener('onclose', function(e) {
    console.log('Calendar is closed');
});
</script>
</html>


Documentation

Methods

Method Description
calendar.open();Open the javascript calendar picker
calendar.close(ignoreEvents);Close the calendar
@param int ignoreEvents - Do no execute onclose event
calendar.getValue();Get the current selected date
calendar.setValue(newValue);Set a new value for the javascript calendar and time picker
@param mixed newValue - New date should be set as YYYY-MM-DD HH:MM:SS
calendar.reset();Reset the input value
calendar.next();Go to the next month
calendar.prev();Go to the previous month


Events

Method Description
onchangeTrigger a method when value is changed.
onupdateTrigger a method when any information change in the calendar picker.
oncloseTrigger a method when the calendar is closed.
onopenTrigger a method when the calendar is closed.


Initial settings

Property Description
type: stringPicker type: default | year-month-picker. Default: default
validRange: [ date, date ]Date selection would be disabled out of this range. Default: null
startingDay: numberStarting weekday - 0 for sunday, 6 for saturday. Default: 0 (Sunday)
format: stringDate format. Default: YYYY-MM-DD
readonly: booleanInput will be disabled for manual changes.
today: booleanIf no value is default, open teh calendar on today as default. Default: false
time: booleanInclude a time picker on the calendar. Default: false
resetButton: booleanShow reset button. Default: true
placeholder: stringPlaceholder instructions
months: arrayMonth short names.
Default: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
monthsFull: arrayMonth short names.
Default: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
weekdays: arrayWeekday names.
Default: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
weekdays_short: arrayWeekday short names.
Default: ['S', 'M', 'T', 'W', 'T', 'F', 'S']
value: stringDefault date.
fullscreen: booleanRender in fullscreen. Default: true for screenWidth: 800px
opened: booleanCalendar starts opened. Default: false.
textDone: stringText of the 'Done' button
textReset: stringText of the 'textReset' button
textUpdate: stringText of the 'Update' button


More examples using the calendar plugin