Skip to content

Date picker ​

A date field that opens a themed calendar and returns a plain YYYY-MM-DD string.

Open in demo
Open in demo

Usage ​

Bind a string with v-model. An empty string means no date. The field shows the date in the app's language, and the calendar starts the week on the day that language uses: Sunday in English, Monday in most European languages, Saturday in Arabic.

SaDatePicker returns a local calendar date, not a timestamp, so a date picked late in the evening east of UTC stays the date the reader picked.

Examples ​

Clearable ​

clearable adds a Clear action inside the popover, which sets the model back to an empty string.

Invalid and disabled ​

invalid sets aria-invalid on the trigger, which draws the field in the destructive color. disabled blocks the popover.

API ​

Source: src/shared/components/common/SaDatePicker.vue

Props ​

PropTypeDefaultDescription
modelValuestringrequiredThe date as YYYY-MM-DD, or an empty string for no date.
idstring—Id on the trigger button, for a <Label for="...">.
placeholderstring'common.pickADate'Text shown when there is no date. A translation key, or plain text.
disabledbooleanfalseBlocks the popover.
invalidbooleanfalseSets aria-invalid on the trigger.
clearablebooleanfalseAdds a Clear action inside the popover.

Emits ​

EventPayloadDescription
update:modelValuevalue: stringThe picked date as YYYY-MM-DD, or an empty string after Clear.

Slots ​

None.

Accessibility ​

  • The trigger is a button. It opens the calendar on Enter or Space, and Escape closes it and returns focus to the trigger.
  • invalid sets aria-invalid="true" on the trigger, so a screen reader announces the field as invalid. Pair it with your own message, as the example does.
  • The calendar is Reka UI's, so the arrow keys move between days and the focused day is announced with its full date.
  • Give the field a visible label with id and <Label for="...">; the component does not invent one.