---
title: "datetime"
image: "https://adonia.pages.dev/og.png"
version: "next"
---

> Documentation Index
> Fetch the complete documentation index at: https://adonia.pages.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# datetime

<!-- Generated by `pnpm docs:fields` from packages/core/src/schema/fields/datetime.ts. Edit the TSDoc, not this file. -->

Date + time picker bound to a timestamp attribute.

| | |
| --- | --- |
| Builder | `F.datetime(attribute: string): DateTimeField` |
| Wire type key | `datetime` |
| Class chain | `DateTimeField` → `TemporalField` → `Field` |
| Detail projection | `text-entry` |
| Column counterpart | `date` cell, i.e. `C.date(attribute)` |

## Example

```ts
import { F } from '@adonia/core'

F.datetime('publishedAt').label('Published at').displayTimezone('Europe/Paris')
```

## Props

Beyond the shared [field DSL](/reference/fields#the-shared-field-dsl):

| Prop | Declared on | Behaviour |
| --- | --- | --- |
| `timezone(zone: string): this` | `TemporalField` | Timezone the civil parts of the value are resolved in (§7.3 "timezone = app tz"). An IANA name (`'Europe/Paris'`) or `'UTC'`; defaults to the app timezone. |
| `displayTimezone(zone: string): this` | `TemporalField` | Timezone the CLIENT renders the value in (§7.3 "display tz configurable"). Presentation only — storage and validation are governed by `TemporalField.timezone`. |
| `after(value: string): this` | `TemporalField` | Lower bound; compiles to Vine's `date.after` (§11.1 "after/before from field rules"). Takes the subtype's own wire form (`2024-01-01`, `2024-01-01T00:00:00.000Z`, `09:00:00`), plus Vine's `'today'` / `'tomorrow'` keywords. |
| `before(value: string): this` | `TemporalField` | Upper bound; compiles to Vine's `date.before` (§11.1). |

### Introspection

Read-only members this type adds — used by the compiler, the table derivation and
tests rather than by a schema author.

| Member | Declared on | Behaviour |
| --- | --- | --- |
| `get zone(): string` | `TemporalField` | The effective timezone: the per-field override, else the app timezone. |
| `instantFor(record: unknown): DateTimeLike \| undefined` | `TemporalField` | The stored value as a Luxon instant, or `undefined` when the attribute is empty or Luxon is unreachable. Exposed for resources that need the instant rather than the wire string (e.g. a `beforeSave` comparison). |

## Validation

Vine base: `vine.date({ formats: parse })`.

§11.1 mapping: `vine.date()` with the subtype's parse formats, plus the
declared `after`/`before` bounds compared at the subtype's granularity.

The bounds carry an explicit `format` so Vine parses the EXPECTED value
with the same shape as the submitted one — without it a `09:00:00`
bound on a `time` field is read as a date and every comparison
collapses to "same day".

Contributed by `TemporalField.vineSchema()` in `packages/core/src/schema/fields/temporal.ts`. The shared modifiers (`required`, `nullable`, `requiredWhen`, `unique`, optionality) are applied on top by `Field.buildValidation`, and a `rules()` override replaces the base entirely — the validator compiler never branches on the field class.

## Declared in

- `packages/core/src/schema/fields/datetime.ts` — `DateTimeField`
- `packages/core/src/schema/fields/temporal.ts` — `TemporalField`

Source: https://adonia.pages.dev/reference/fields/datetime/index.mdx
