Skip to content

@nepdatejs/vanilla ​

Web Components and a plain JavaScript API. See Web Components and Plain JavaScript API.

EntryContains
@nepdatejs/vanillaEverything, with no side effects
@nepdatejs/vanilla/defineImporting it registers every element
@nepdatejs/vanilla/date-pickerDate picker only
@nepdatejs/vanilla/date-range-pickerRange picker only
@nepdatejs/vanilla/date-time-pickerDate and time picker only
@nepdatejs/vanilla/multi-date-pickerMultiple dates only
@nepdatejs/vanilla/calendarCalendar only

Shared attributes ​

The pickers all accept these:

AttributeMeaning
min, maxLimits, AD
calendarBS or AD, fixed
default-calendarThe calendar shown first
localeen, ne or a registered code
nameForm field name
required, disabledAs on an input
themelight, dark or auto
panel-layoutauto, popover or sheet
inlineAlways show the calendar
mask="false"Don't add dashes while typing

<nep-date-picker> ​

AttributeMeaning
valueStarting value, AD
placeholderInput placeholder
clearable="false"Hide the clear button
show-equivalent="false"Hide the other-calendar line
close-on-select="false"Keep the panel open after a pick
persist-calendarlocalStorage key for the BS/AD choice
week-starts-on0 to 6
display-formatHow the input shows a date, such as long
presetsShortcut IDs, separated by commas
labelThe input's aria-label
input-idThe input's id, for <label for>
  • Properties: value, form, holidays, events, isDateDisabled, presets.
  • Methods: open(), close(), focus(), checkValidity(), reportValidity().
  • Events: change with { value, ad, bs }, nep-open, nep-close, nep-calendar-change with { calendar }.

<nep-date-range-picker> ​

AttributeMeaning
start, endStarting values, AD
start-name, end-nameField names. Default <name>-start and <name>-end
min-days, max-daysShortest and longest range
fiscal-yearsShow the Fiscal year button
presetsShortcut IDs, separated by commas
start-label, end-labelAccessible names of the two inputs
  • Properties: value, holidays, isDateDisabled, presets.
  • Events: change with { value: { start, end } }, nep-open, nep-close.

<nep-date-time-picker> ​

AttributeMeaning
valueStarting value, an ISO timestamp
time-zoneThe zone shown and stored
hour1212-hour display
minute-stepMinutes between choices
default-timeUsed when a day is picked first
presetsShortcut IDs, separated by commas
label, time-labelAccessible names of the two inputs
  • Properties: value, holidays, isDateDisabled.
  • Events: change with { value, ad, bs, time }, nep-open, nep-close.

<nep-multi-date-picker> ​

AttributeMeaning
valueStarting days, AD, separated by commas
max-datesThe most days allowed
clearable="false"Hide the clear button
close-on-selectClose after each click
labelThe input's aria-label
  • Properties: value (an array), holidays, events, isDateDisabled.
  • Events: change with { value, dates }, nep-open, nep-close.

<nep-calendar> ​

AttributeMeaning
valueThe selected day, AD
calendarBS or AD
localeNames and digits
min, maxLimits, AD
week-starts-on0 to 6
show-other-calendar="false"Hide the other calendar's digits
show-outside-days="false"Hide days of nearby months
rangeSelect a range
themelight, dark or auto
  • Properties: store, holidays, events, isDateDisabled.
  • Events: nep-select with { date, value }, or { range: { start, end } }.

Functions ​

FunctionReturns
defineElements(registry?)Registers every element
defineDatePicker, defineDateRangePicker, defineDateTimePicker, defineMultiDatePicker, defineCalendarRegisters one
createDatePicker(target, options?)DatePickerHandle. target may be an <input>
createDateRangePicker(container, options?)DateRangePickerView
createDateTimePicker(container, options?)DateTimePickerView
createMultiDatePicker(container, options?)MultiDatePickerHandle
createCalendar(container, options?)CalendarHandle

ELEMENT_NAMES lists the tag names.

Classes ​

The elements, NepDatePickerElement, NepDateRangePickerElement, NepDateTimePickerElement, NepMultiDatePickerElement and NepCalendarElement, and the views they use, DatePickerView, DateRangePickerView, DateTimePickerView, MultiDatePickerView and CalendarView.

Released under the MIT licence.