Copyright © 2023 MIT License. | Design and development by Yury Uvarov.
💢 Usage example

biletiki.store — a website example for searching for flight tickets and hotels using vanilla-calendar.

Main

Read-Only Parameters

After initializing the calendar, additional read-only parameters are created. These parameters contain information about the current state of the calendar, which is automatically updated when interacting with it.

The calendar's state changes with every interaction, which leads to the update of these parameter values. This is why they are available for reading only.

HTMLElement

Type: HTMLElement

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.HTMLElement);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.HTMLElement);

The HTMLElement property contains the root HTML element in which the calendar was initialized.


HTMLOriginalElement

Type: HTMLElement

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.HTMLOriginalElement);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.HTMLOriginalElement);

The HTMLOriginalElement property contains the original root HTML element without any modifications, in which the calendar was initialized.


HTMLInputElement

Type: HTMLElement

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.HTMLInputElement);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.HTMLInputElement);

The HTMLInputElement property represents the root HTML element that is an input field.


currentType

Type: string

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.currentType);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.currentType);

The currentType property contains the current type of the calendar.


dateMin

Type: Date

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.dateMin);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.dateMin);

The dateMin property represents the minimum date in the Date object format.


dateMax

Type: Date

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.dateMax);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.dateMax);

The dateMax property represents the maximum date in the Date object format.


rangeMin

Type: string

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.rangeMin);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.rangeMin);

The rangeMin property contains the current minimum date.


rangeMax

Type: string

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.rangeMax);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.rangeMax);

The rangeMax property contains the current maximum date.


rangeDisabled

Type: string[]

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.rangeDisabled);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.rangeDisabled);

The rangeDisabled property represents an array of disabled dates.


rangeEnabled

Type: string[]

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.rangeEnabled);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.rangeEnabled);

The rangeEnabled property contains an array of enabled dates.


selectedDates

Type: string[]

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedDates);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedDates);

The selectedDates property contains an array of currently selected dates.


selectedHolidays

Type: string[]

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedHolidays);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedHolidays);

The selectedHolidays property represents an array of selected holiday dates.


selectedMonth

Type: number

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedMonth);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedMonth);

The selectedMonth property contains the number of the currently selected month.


selectedYear

Type: number

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedYear);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedYear);

The selectedYear property represents the number of the currently selected year.


selectedHours

Type: string

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedHours);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedHours);

The selectedHours property contains the currently selected hour.


selectedMinutes

Type: string

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedMinutes);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedMinutes);

The selectedMinutes property represents the currently selected minutes.


selectedKeeping

Type: string | null

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedKeeping);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedKeeping);

The selectedKeeping property contains the AM/PM marker for the 12-hour time format.


selectedTime

Type: string | null

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedTime);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.selectedTime);

The selectedTime property contains the full current time.


correctMonths

Type: number

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.correctMonths);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.correctMonths);

The correctMonths property contains the current number of months to display if the calendar type is set to 'multiple'.


viewYear

Type: number

js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.viewYear);
js
const calendar = new VanillaCalendar('#calendar');
console.log(calendar.viewYear);

The viewYear property represents the current displayed year.