Skip to content

Use refs or constructor data for rules? #3

@capopovici

Description

@capopovici

Hello,

Is there a way to use refs or constructor data in the standalone use?

The below code doesn't work, type error for this: Object is possibly 'undefined'

  public refs = schema.refs({
    today: luxon.utc().toISODate(),
  })

  @validate(schema.date({ format: 'yyyy-MM-dd' }, [rules.before(this.refs.today)]))
  public date: DateTime

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions