# field.date

A date, a time or both. Pass type="time" or "datetime-local" for a time; min and max limit the range

Component: [`<Field>`](https://www.prongs.dev/docs/components/field.md) · Renders: `<input type="date">` · Profile: [UI](https://www.prongs.dev/docs/intents/ui.md) · Comes from: starter

## Example

```tsx
<Field intent="field.date" label="Due date" />
<Field intent="field.date" type="time" label="Starts at" />
```

Code that says `date`, `time`, `day`, `when`, `deadline` points here. `prongs check` warns when an element with this intent has a handler or label that points somewhere else.

## Choosing between neighbours

Find the row that describes your element, and use the intent on the right.

| If it is for… | Use |
|---|---|
| A date, a time or both. Pass type="time" or "datetime-local" for a time; min and max limit the range | `field.date` (this page) |
| A length of time, like 30 minutes | [`field.number`](https://www.prongs.dev/docs/intents/field/number.md) |

## Connections

Declared in the registry, both directions. Where an intent is used in your own code is something check and the gallery see; this site has no app code.

- Built from: [`input.default`](https://www.prongs.dev/docs/intents/ui.md#input-default)

## For registry authors

**Starter intents.** These are the intents `prongs add` puts in your registry, shown in this site’s theme. Yours are your own `registry.ts`: rename, restyle and add to them, and see them with `prongs add gallery`.

What this intent is built from and its entry in `components/prongs/registry.ts`. You only need this to change how it looks or to add an intent like it.

How field.date resolves, and its definition

Each layer adds to the one before it; a later class wins over an earlier one that sets the same thing.

- [`input.default`](https://www.prongs.dev/docs/intents/ui.md#input-default) — Bordered input box

  ```
  w-full min-w-0 rounded-md border border-input bg-background pl-3
  pr-3 py-2 text-base text-foreground
  placeholder:text-surface-muted focus-visible:outline-none
  focus-visible:ring-2 focus-visible:ring-ring
  disabled:cursor-not-allowed disabled:opacity-50
  aria-invalid:border-destructive
  ```

- `field.date` (this page) — A date, a time or both. Pass type="time" or "datetime-local" for a time; min and max limit the range

Final classes

```
w-full min-w-0 rounded-md border border-input bg-background pl-3
pr-3 py-2 text-base text-foreground
placeholder:text-surface-muted focus-visible:outline-none
focus-visible:ring-2 focus-visible:ring-ring
disabled:cursor-not-allowed disabled:opacity-50
aria-invalid:border-destructive
```

Element behaviour

```
{ type: 'date' }
```

Definition

```ts
'field.date': {
  kind: 'semantic',
  description: 'A date, a time or both. Pass type="time" or "datetime-local" for a time; min and max limit the range',
  refs: ['input.default'],
  keywords: ['date', 'time', 'day', 'when', 'deadline'],
  binding: { behavior: { type: 'date' } },
  notFor: [
    {
      context: 'a length of time, like 30 minutes',
      instead: 'field.number',
    },
  ],
},
```
