# API of `@koobiq/components/datetime`

Documented on [Datetime](https://koobiq.io/en/components/datetime.md). NgModule: `KbqDatetimeModule`.

## Components

### KbqDatetime (component)

A date and a time in one form field: a date input with a calendar and a time input that share one value.

The value is a date of the date adapter, and it is `null` until both parts are filled in.

```ts
@Component({ selector: 'kbq-datetime', exportAs: 'kbqDatetime' })
class KbqDatetime<D> implements KbqFormFieldControl<D>, ControlValueAccessor, Validator {
    readonly errorStateMatcher = input<ErrorStateMatcher>();
    readonly required = input<boolean>(false);
    readonly id = input<string | undefined>();
    readonly disabled = input<boolean>(false);
    readonly format = input<TimeFormats>(DEFAULT_TIME_FORMAT);
    readonly min = input<D | null>(null);
    readonly max = input<D | null>(null);
    readonly value: Signal<D | null>;
    readonly datepicker: Signal<KbqDatepicker<D>>;
    focus(options?: FocusOptions): void;
    open(): void;
    close(): void;
}
```

- `[errorStateMatcher]`: `ErrorStateMatcher` — Object used to control when error messages are shown.
- `[required]`: `boolean` — Whether the control is required. Defaults to `false`.
- `[id]`: `string | undefined` — Unique id of the element, generated when not provided.
- `[disabled]`: `boolean` — Whether the control is disabled. Also set by the bound form control. Defaults to `false`.
- `[format]`: `TimeFormats` — Time format the time part parses and renders. Defaults to `TimeFormats.HHmm`.
- `[min]`: `D | null` — Earliest date and time the control accepts, reported as `kbqDatetimeMin`. The calendar disables the days
  before it. Defaults to `null`.
- `[max]`: `D | null` — Latest date and time the control accepts, reported as `kbqDatetimeMax`. The calendar disables the days
  after it. Defaults to `null`.
- `value`: `Signal<D | null>` — The date and time the control holds, `null` until both parts are filled in.
- `datepicker`: `Signal<KbqDatepicker<D>>` — The calendar of the date part, for a `kbq-datepicker-toggle-icon` placed in the form field.
- `focus()`: `void` — Focuses the first part left empty, the date part when there is none.
- `open()`: `void` — Opens the calendar.
- `close()`: `void` — Closes the calendar.

## Constants

### KBQ_DATETIME_MAX_ERROR (const)

Key of the error `KbqDatetime` reports for a value after its `max`.

```ts
const KBQ_DATETIME_MAX_ERROR: string;
```

### KBQ_DATETIME_MIN_ERROR (const)

Key of the error `KbqDatetime` reports for a value before its `min`.

```ts
const KBQ_DATETIME_MIN_ERROR: string;
```

### KBQ_DATETIME_PARSE_ERROR (const)

Key of the error `KbqDatetime` reports for a text that is not a date and time, or for a single part filled in.

```ts
const KBQ_DATETIME_PARSE_ERROR: string;
```
