We recommend to wrap the datepicker in a dt-popover component.
It is required to provide the component with proper labels for i18n and accessibility.
The component will return a Date object object when a date is selected.
For the withPopover variant it is necessary to provide the initial-focus-element="#prevYearButton" prop
to the dt-popover component.
With this we accomplish the requirement to have the previous year button focused when the datepicker is opened.
<dt-datepicker></dt-datepicker>
<dt-popover :open="datepickerOpened" initial-focus-element="#prevYearButton" padding="none" @opened="(open) => { datepickerOpened = open }" placement="bottom-start" > <template #anchor> <dt-button :size="200" circle importance="clear" aria-label="Open datepicker" @click="toggleDatepicker" > <template #startIcon> <dt-icon name="calendar" size="300" /> </template> </dt-button> </template> <template #content> <dt-datepicker></dt-datepicker> </template> </dt-popover>
Constrain the selectable date range by providing min-date and/or max-date props. Days outside the range are disabled and navigation buttons are disabled when the target month is fully out of range.
<script> const today = new Date(); const minDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 5); const maxDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 15); </script> <dt-datepicker :selected-date="new Date()" :min-date="minDate" :max-date="maxDate" />
The following functions are available for date formatting.
| Su | Mo | Tu | We | Th | Fr | Sa |
|---|
Sat Sep 05 2026 00:05:24 GMT+0000 (Coordinated Universal Time)
formatLong | Saturday, September 5, 2026 |
|---|---|
formatMedium | September 5, 2026 |
formatShort | Sat, Sep 5, 2026 |
formatShort (no weekday) | Sat, Sep 5, 2026 |
formatNoYear | September 5 |
formatNoYear (abbreviated) | September 5 |
formatNumerical | 09/05/26 |
formatLong(date, locale): string
Formats a date into a long format using the specified locale.
| Name | Type | Description |
|---|---|---|
date | Date | The date to format |
locale | string | The locale to use for formatting. Defaults to Dialtone preferred locale. |
string
The formatted date string.
formatMedium(date, locale): string
Formats the given date in medium format.
| Name | Type | Description |
|---|---|---|
date | Date | The date to format |
locale | string | The locale to use for formatting. Defaults to Dialtone preferred locale. |
string
The formatted date string.
formatShort(date, locale, showWeekday= true): string
Formats a date into a short string representation.
| Name | Type | Description |
|---|---|---|
date | Date | The date to format |
locale | string | The locale to use for formatting. Defaults to Dialtone preferred locale. |
showWeekday | boolean | Whether to include the weekday in the formatted string. Defaults to true. |
string
The formatted date string.
formatNoYear(date, locale, abbreviated= false): string
Formats a date without the year.
| Name | Type | Description |
|---|---|---|
date | Date | The date to format |
locale | string | The locale to use for formatting. Defaults to Dialtone preferred locale. |
abbreviated | boolean | Whether to use abbreviated month names. Defaults to false. |
string
The formatted date without the year.
formatNumerical(date, locale): string
Formats a date into a numerical string representation.
| Name | Type | Description |
|---|---|---|
date | Date | The date to format |
locale | string | The locale to use for formatting. Defaults to Dialtone preferred locale. |
string
The formatted numerical date string.
Keyboard navigation with arrow and tab keys for datepicker component.
It will switch between month-year-picker and calendar with TAB.
It will move around all calendar days with arrow-keys.
It will jump from month-year-picker to calendar with DOWN arrow key.
It will jump to month-year-picker when there are no more days at the bottom or top of the calendar.
It will change year or month with ENTER or SPACE (native event)
It will select day with ENTER or SPACE (native event)
It will start with focus on previous-year on mounted. Screen reader announcement:
In `month-year-picker`:
- Change to previous year, 2022
- Change to previous month, july
- Change to next month, september
- Change to next year, 2024
In `calendar`:
- Select day 20 July 2023
import { DtDatepicker } from '@dialpad/dialtone-vue';
Name
|
Default
|
Type
|
|---|---|---|
maxDate | null | Date Maximum selectable date. Days after this date will be disabled.
Must be after or equal to minDate when both are provided. |
minDate | null | Date Minimum selectable date. Days before this date will be disabled.
Must be before or equal to maxDate when both are provided. |
selectedDate | () => (new Date()) | Date Selected date |
weekStartsOn | 0 |
"0"
|
"1"
|
"2"
|
"3"
|
"4"
|
"5"
|
"6"
Day the week starts on. 0 = Sunday, 1 = Monday, ... 6 = Saturday. |
Name
|
Type
|
|---|---|
close-datepicker | Event fired when user presses the esc key |
selected-date | Date Event fired when a date is selected |
Datepicker documentation last updated Friday, September 4, 2026
fix/popover-modal-zindex-scope