Local date range picker

Selects a range of local dates.

One important part is that it is local dates (according to your browser settings) we are handling. Both endpoints are included in the range, and it is up to you how you should interpret the selected range. Single local date can also be selected, in which case the endpoints are equal.

On the project page, NNM Local date range picker, you can read more details and the theory and background on the ideas and decisions.

Examples

Below are some examples and at the Local dates page you have even more.

No predefined local date range (default component)

Predefined local date range

Single day

Nearest months

Full years

Quarters and half years

Min/max defined

Min/max defined and predefined local date range

Optional slot for label

Vacation days

Calculating number of days for year-to-date

nnm-local-date-range-picker

Attributes

min-local-date
max-local-date
Optional. Format YYYY-MM-DD. Denotes min/max selectable local dates.
selected-from-local-date
selected-to-local-date
Optional. Format YYYY-MM-DD. Indicates the starting/ending local dates for a currently selected range.

Slots

[default]
Optional. Will be displayed as a label in the popup modal.

Emits

local-date-range-selected
Emitted when either Apply button, Clear icon or Quick list button is clicked. Event details contains properties:

Keys

The following keys are active when the modal is open.

ESC
Closes modal.

Changing displayed months

a
Goto first month (if min-local-date defined).
s
Goto previous month.
d
Goto next month.
f
Goto last month (if max-local-date defined).

Centering specific months

e
Center current month.
r
"Center" the selected range. Tries to show as much as possible of the range, and also tries to minimize the distance to current month.

Modifying selected range

Note: These keys are disabled when implicit min/max mode is used.

Shift + ArrowLeft
Move "selected from date" one day to the left (increases range).
Shift + ArrowRight
Move "selected from date" one day to the right (decreases range).
ArrowLeft
Move "selected range" one day to the left, i.e. one day earlier.
ArrowRight
Move "selected range" one day to the right, i.e. one day later.
Alt + ArrowLeft
Move "selected to date" one day to the left (decreases range).
Alt + ArrowRight
Move "selected to date" one day to the right (increases range).
Shift + ArrowUp
Move "selected range" seven days to the left, i.e. one week earlier.
Shift + ArrowDown
Move "selected range" seven days to the right, i.e. one week later.

Expanding/shrinking selected range

Note: These keys are disabled when implicit min/max mode is used.

q
Shrinking range, if possible. The range may be shrinked to half year, quarter, month, week and original value. You can not go lower than your original value.
w
Expanding range, if possible. The range may be expanded to week, month, quarter, half year and year. If you have selected 16 April 2022:

Example ranges that are supported in the current version

Project page