Skip to content

JavaScript Calendar Quick Reference

A new version of the jSuites JavaScript Calendar plugin is available here.

jSuites Calendar v5

Consider the following example:

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

<input id='calendar'>

<script>
var myCalendar = jSuites.calendar(document.getElementById('calendar'), {
    format: 'DD/MM/YYYY'
});
</script>
</html>
MethodDescription
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
MethodDescription
onchangeTrigger a method when value is changed.
onchange(DOMElement element, string currentValue, string previousValue) => void
onupdateTrigger a method when any information change in the calendar picker.
onupdate(DOMElement element, string value) => void
oncloseTrigger a method when the calendar is closed.
onupdate(DOMElement element) => void
onopenTrigger a method when the calendar is closed.
onupdate(DOMElement element) => void
PropertyDescription
type: stringPicker type: 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']
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
controls: booleanShow the controls. Default: true
PatternDescription
HHhour of day (01-12)
HH12hour of day (01-12)
HH24hour of day (00-23)
MIminute (00-59)
SSsecond (00-59)
MSmillisecond
AM or PMmeridian indicator
h:m AM/PMthis format, with one or two h or m, is handled in a special way, referring to hours and minutes in the 12-hour system. If "AM/PM" is omitted, the 24-hour system is adopted
YYYYyear 4 digits of year
YYYlast 3 digits of year
YYlast 2 digits of year
Ylast digit of year
MMMMMFirst letter of month name
MMMMFull month name
MMMAbbreviated month name
MM or Mmonth number (01-12)
MONTHFull upper case month name
MonthFull capitalized month name
monthFull lower case month name
MONAbbreviated upper case month name
MonAbbreviated capitalized month name
monAbbreviated lower case month name
DDDDFull day name
DDDAbbreviated day name
DDDay of month (01-31)
DDay of the week (starting on zero for Sundays)
DAYFull upper case day name
DayFull capitalized day name
dayFull lower case day name
DYAbbreviated upper case day name
DyAbbreviated capitalized day name
dyAbbreviated lower case day name
WDDay of the week starting on zero for Sunday