UNPKG

joiful

Version:

TypeScript Declarative Validation. Decorate your class properties to validate them using Joi.

30 lines (29 loc) 1.24 kB
import * as Joi from 'joi'; import { TypedPropertyDecorator } from '../core'; import { ModifierProviders, JoifulOptions } from './common'; import { AnySchemaModifiers } from './any'; export interface DateSchemaModifiers extends AnySchemaModifiers { /** * Coerces value to a Date object from string value in valid ISO 8601 date format. */ iso(): this; /** * Specifies the maximum value. * @param limit The maximum value. */ max(limit: number | 'now' | string | Date): this; /** * Specifies the minimum value. * @param limit The minimum value. */ min(limit: number | 'now' | string | Date): this; /** * Coerces value to a Date object from a timestamp interval from Unix/Javascript Time * @param type unix or javaScript */ timestamp(type?: 'unix' | 'javascript'): this; } export declare function getDateSchemaModifierProviders(getJoi: () => typeof Joi): ModifierProviders<Joi.DateSchema, DateSchemaModifiers>; export interface DateSchemaDecorator extends DateSchemaModifiers, TypedPropertyDecorator<Date> { } export declare const createDatePropertyDecorator: (joifulOptions: JoifulOptions) => import("./common").PropertyDecorator<Date, DateSchemaModifiers>;