Skip to main content

Date Range

Description

<jp-date-range> is a field component with <input type="date"> from/to functionality.


Attributes

NameRequiredTypeDescription
namestringname of the form control
separatorstringstring between the dates
valuestring˛ (Date() constructor params with separator inbetween)setter
labelstringlabel displayed on date field
labelType'outside' or 'inside'whether label is inside or outside of the field
requiredbooleandetermines if date needs to be selected
requiredValidationMessagestringvalidation message for when component does not satisfy required
returnFormatcustom | json | unix | js | utc | iso | isoDateformat of exposing value (through events and methods)
returnFormatFunctionif returnFormat
is custom
(date:Date) => anycustom return format function
displayFormatcustom | normal | short | medium | long | fullformat of displayed date in the field
displayFormatFunctionif displayFormat
is custom
(date:Date) => stringcustom display format function
minDatestring | Date earliest date that can be selected by the user.
maxDatestring | Date last date that can be selected by the user.
maxSelectableDaysnumbernumber of days that can be in range
minSelectableDaysnumbernumber of days that must be in range
maxDateSelectableDateAutomatically set based on the value of maxSelectableDays
minDateSelectableDateAutomatically set based on the value of maxSelectableDays


Slots

This component does not have any slots.



Methods

  • getValue
    • returns form field value
  • reportValidity
    • triggers reportValidity


Events

  • value
    • triggers when value of the field changes


Demo

Live Editor
// import '@jaspero/web-components/date-range.wc.js';
// import '@jaspero/web-components/date-range.css';

<jp-date-range label="Pick a date range"></jp-date-range>
Result
Loading...