UNPKG

@kform/react

Version:

React integration for KForm.

22 lines (21 loc) 1.12 kB
import { Instant, LocalDate, LocalDateTime, Schema } from "@kform/core"; /** * Supported date or time related types. */ export type Temporal = Instant | LocalDate | LocalDateTime | Date; /** * Formats a temporal {@link value} as a string, given its {@link schema}. * @param value Temporal value to format as a string. * @param schema Schema of the temporal {@link value}. * @returns String representation of the temporal {@link value}. */ export declare function formatTemporalAsString<T extends Temporal | null = Temporal | null>(value: T | undefined, schema: Schema<T>): string; /** * Parses a formatted temporal [value]{@link formattedValue} as a temporal * value, given the {@link schema} of the expected temporal value. * @param formattedValue Formatted value to parse as a temporal value. * @param schema Schema of the expected temporal value. * @returns Temporal representation of the * [formatted value]{@link formattedValue} according to {@link schema}. */ export declare function parseStringAsTemporal<T extends Temporal | null = Temporal | null>(formattedValue: string, schema: Schema<T>): T;