# Date picker

Source: https://ecosphere.dev/docs/forms/date-picker (Ecosphere 1.5). Install `vue-ecosphere` for Vue 3 or `react-ecosphere` for React 18.2+/19: same components, props, markup and stylesheet.

A date field and the month grid that opens from it.

`import { EcoDatePicker } from "vue-ecosphere"`

## Date field

Click the field or press ArrowDown to open the calendar; pick a day and Apply. Typing a date works too.

Vue (vue-ecosphere):

```vue
<EcoDatePicker v-model="start" label="Start date" hint="DD/MM/YYYY" first />
```

React (react-ecosphere):

```tsx
const [start, setStart] = useState("2026-08-08");

<EcoDatePicker value={start} onChange={setStart} label="Start date" hint="DD/MM/YYYY" first />
```

## Empty

Vue (vue-ecosphere):

```vue
<EcoDatePicker v-model="due" label="Due date" placeholder="DD/MM/YYYY" first />
```

React (react-ecosphere):

```tsx
const [due, setDue] = useState("");

<EcoDatePicker value={due} onChange={setDue} label="Due date" placeholder="DD/MM/YYYY" first />
```

## Range

Each end bounds the other with min and max.

Vue (vue-ecosphere):

```vue
<EcoFieldGrid first>
  <EcoDatePicker v-model="from" label="From" :max="to" />
  <EcoDatePicker v-model="to" label="To" :min="from" />
</EcoFieldGrid>
```

React (react-ecosphere):

```tsx
const [from, setFrom] = useState("2026-08-01");
const [to, setTo] = useState("2026-08-31");

<EcoFieldGrid first>
  <EcoDatePicker value={from} onChange={setFrom} label="From" max={to} />
  <EcoDatePicker value={to} onChange={setTo} label="To" min={from} />
</EcoFieldGrid>
```

## API

Vue (vue-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `v-model` | `string` | "" | ISO date, YYYY-MM-DD. The field shows DD/MM/YYYY and stays typeable. |
| `v-model:open` | `boolean` | false | Whether the calendar is open. |
| `min / max` | `string (ISO)` | — | Days outside the range are disabled. |
| `locale` | `string` | "en-GB" | Month name, weekday letters and day labels. |
| `today` | `string (ISO)` | — | Override today (is-today), e.g. for a fixed demo. |
| `todayLabel / applyLabel` | `string` | "Today" / "Apply" | Footer actions. Apply commits the chosen day. |
| `label / required / hint / error / invalid / first / disabled / placeholder / id` | `—` | — | Field props. Put the format in the hint, not the placeholder. |
| `Keyboard` | `—` | — | ArrowDown opens; arrows move by day/week, Home/End the week, PageUp/PageDown the month (Shift: year), Enter picks, Escape closes. |

React (react-ecosphere):

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `value / onChange` | `string` | "" | ISO date, YYYY-MM-DD (defaultValue when uncontrolled). The field shows DD/MM/YYYY and stays typeable; a typed date commits on the native change event (blur or Enter). |
| `open / onOpenChange` | `boolean` | false | Whether the calendar is open. |
| `min / max` | `string (ISO)` | — | Days outside the range are disabled. |
| `locale` | `string` | "en-GB" | Month name, weekday letters and day labels. |
| `today` | `string (ISO)` | — | Override today (is-today), e.g. for a fixed demo. |
| `todayLabel / applyLabel` | `string` | "Today" / "Apply" | Footer actions. Apply commits the chosen day. |
| `label / required / hint / error / invalid / first / disabled / placeholder / id` | `—` | — | Field props. Put the format in the hint, not the placeholder. |
| `Keyboard` | `—` | — | ArrowDown opens; arrows move by day/week, Home/End the week, PageUp/PageDown the month (Shift: year), Enter picks, Escape closes. |
