functional-models
    Preparing search index...

    Function DateProperty

    • A Property for Dates. Supports both strings and Date objects. This does NOT include time information.

      Parameters

      • config: { format?: string; formatFunction?: (date: Date, format?: string) => string } & Readonly<
            Partial<
                {
                    autoNow: boolean;
                    choices: readonly ChoiceTypes[];
                    defaultValue: DateValueType;
                    fetcher: ModelInstanceFetcher;
                    isDenormalized: boolean;
                    lazyLoadMethod: <TData extends Readonly<{ [s: string]: any }>>(
                        value: DateValueType,
                        modelData: CreateParams<TData>,
                    ) => DateValueType;
                    lazyLoadMethodAtomic: <TData extends Readonly<{ [s: string]: any }>>(
                        value: DateValueType,
                        modelData: CreateParams<TData>,
                    ) => Promise<DateValueType>;
                    maxLength: number;
                    maxValue: number;
                    minLength: number;
                    minValue: number;
                    typeOverride: string;
                    validators: readonly PropertyValidatorComponent<any, object, object>[];
                    value: DateValueType;
                    valueSelector: (
                        instanceValue: MaybePromise<DateValueType>,
                    ) => DateValueType;
                },
            >,
        > & Readonly<
            {
                isArray?: boolean;
                isBoolean?: boolean;
                isInteger?: boolean;
                isNumber?: boolean;
                isString?: boolean;
                required?: boolean;
            },
        > = {}

        A configuration that enables overriding of date formatting

        • Optionalformat?: string

          The format the date should be in. This is a framework agnostic format, and should be based on your format function. NOTE: If a formatFunction is not provided, this is completely ignored. For dates YYYY-MM-DD is the default and for Datetimes it is ISOString()

        • OptionalformatFunction?: (date: Date, format?: string) => string

          A function that can format the date into a string. Can use date-fns, moment, or any other function.

      • additionalMetadata: {} = {}

      Returns Readonly<
          {
              createGetter: (
                  value: DateValueType,
                  modelData: Readonly,
                  modelInstance: ModelInstance<
                      Readonly<{ [s: string]: any }>,
                      object,
                      object,
                  >,
              ) => ValueGetter<
                  DateValueType,
                  Readonly<{ [s: string]: any }>,
                  object,
                  object,
              >;
              getChoices: () => readonly ChoiceTypes[];
              getConfig: () => object;
              getConstantValue: () => undefined | DateValueType;
              getDefaultValue: () => undefined | DateValueType;
              getPropertyType: () => string;
              getValidator: (
                  valueGetter: ValueGetter<
                      DateValueType,
                      Readonly<{ [s: string]: any }>,
                      object,
                      object,
                  >,
              ) => PropertyValidator<Readonly<{ [s: string]: any }>>;
          },
      >