Datepicker
Usage
Datepicker is a calendar-style input for choosing a date, a time, or both together. Use it when a structured picker is safer and faster than freeform date input, and use range mode when users need to define a start and end date in one field.
import { MtDatepicker } from "@shopware-ag/meteor-component-library";
Examples
Date only
Time only
Range
API reference
Props
| Prop | Type | Default |
|---|---|---|
labelA label for your date picker field. It helps the user understand what this field is for. | string | null | null |
date-typeDefines the type of the date picker.
Options: "date" (for selecting a date), or "datetime" (for selecting both). | "time" | "datetime" | "date" | "datetime" |
localeSets the locale for the date picker.
This affects things like the language used for month names and weekdays. | string | "de" |
formatThe format of the date picker.
You can use a string or a function to format the date. | string | ((date: Date) => string) | ((dates: Date[]) => string) | undefined | undefined |
time-zoneDefines the time zone for the date picker.
Useful for adjusting date and time according to a specific timezone. | string | "UTC" |
model-valueThe value of the date picker. Can be a single string or an array of strings.
This represents the currently selected date(s). | string | string[] | Date | Date[] | null | null |
placeholderPlaceholder text to show in the date picker input field when no date is selected. | string | "Y-m-d ..." |
is24Determines if the timepicker is in 24 or 12 hour format | boolean | true |
requiredDetermines if the date picker field is required.
If true, the user must select a value before submitting the form. | boolean | false |
disabledDetermines if the date picker field is disabled.
If true, the user will not be able to interact with the field. | boolean | false |
rangeEnables the date range selection feature.
If true, the user can select a start and end date. | boolean | false |
sizeSets the size of the datepicker.
Options: "small" or "default". | "default" | "small" | "default" |
errorAn error in your business logic related to this field.
For example: {"code": 500, "detail": "Error while saving"} | { code?: number | undefined; detail?: string | undefined; } | null | null |
help-textHelp text for the date picker. | string | undefined |
min-dateThe minimum selectable date. Can be a Date object or an ISO string.
Any date before this will be disabled in the calendar.
For example: "today" | string | Date | undefined |
hour-incrementThe increment for hours in the time picker grid.
Controls how many hours are skipped when navigating through the hours overlay. | number | 1 |
minute-incrementThe increment for minutes in the time picker grid.
Controls how many minutes are skipped when navigating through the minutes overlay. | number | 1 |
text-inputEnables typing directly into the input field. | boolean | false |
max-dateThe maximum selectable date.
Can be a Date object or an ISO string | string | Date | undefined |
Events
| Event | Payload |
|---|---|
update:modelValue | [value: string | string[] | (string | null)[] | null] |
Best practices
Do
- Match the
dateTypeto the value users actually need, such asdate,time, ordatetime. - Use a clear label so users know what event, deadline, or schedule the value belongs to.
- Set the timezone intentionally when the chosen value is shared across regions or systems.
Don't
- Do not use Datepicker when a plain text field is enough for a non-date value.
- Do not expose time selection if the feature only needs a date.
- Do not leave timezone behavior implicit when it affects saved values.
Behavior
dateTypecontrols whether the picker behaves as a date, time, or datetime input.rangelets one field hold a start and end value.timeZoneaffects how values are interpreted and displayed.helpText,required,disabled,error, andsizeintegrate with the shared field styling.
Accessibility
- Always provide a visible label so users understand what date or time they are setting.
- Use the simplest picker mode that fits the task, because extra controls increase interaction cost.
- If timezone matters for the saved value, explain that nearby instead of relying only on the hint.