Check out a new date picker: easepick

Date range picker using Shadow DOM. Lightweight size, no dependencies.

Link Search Menu Expand Document

Methods


DateTime 2.0.0+

Arguments: (date)

Return: DateTime

date is optional, if empty, will used new Date().

Examples:

const picker = new Litepicker({ ... });

picker.DateTime(); // return DateTime object
// or
picker.DateTime(new Date()); // also return DateTime object based on provided Date object

clearSelection

Arguments: ()

Return: void

Clear selection.

destroy

Arguments: ()

Return: void

Destroy the picker.

getDate

Arguments: ()

Return: DateTime

Alias of getStartDate.

getEndDate

Arguments: ()

Return: DateTime

Return current end of date range as DateTime Object.

getStartDate

Arguments: ()

Return: DateTime

Return current start of date range as DateTime Object.

gotoDate

Arguments: (date, idx)

Return: void

Set month by the date.

date is should be Date Object or Unix Timestamp (with milliseconds) or String (must be equal to option format).

idx is required when option splitView is enabled.

hide

Arguments: ()

Return: void

Hide the picker.

setDate

Arguments: (date, force)

Return: void

Set date when singleDate is true.

date is should be Date Object or Unix Timestamp (with milliseconds) or String (must be equal to option format).

since 2.0.5:

  • force is Boolean, default: false. When true ignores locked days when selection.

setDateRange

Arguments: (date1, date2, force)

Return: void

Set date range.

date1, date2 is should be Date Object or Unix Timestamp (with milliseconds) or String (must be equal to option format).

since 2.0.5:

  • force is Boolean, default: false. When true ignores locked days when selection.

setHighlightedDays

Arguments: (array)

Return: void

Set highlighted days.

See options highlightedDays for format information.

setLockDays

Arguments: (array)

Return: void

Set lock days.

See options lockDays for format information.

setOptions

Arguments: (object)

Return: void

Set new options to the picker.

Options element, elementEnd, parentEl cannot be changed.

show

Arguments: ()

Return: void

Make the picker visible.

Deprecated setBookedDays

Arguments: (array)

Return: void

Set booked days.

See options bookedDays for format information.

Reason: Since v2.0.0 there is no option bookedDays.

Replacement:

use setLockDays instead of setBookedDays.