Skip to content

date validator: inconsistent meaning of allowBlank #65

@bgentry

Description

@bgentry

The date validation has an option isBlank which is documented like so:

If true, skips validation if the value is empty

This accurately describes the implementation, which skips validation if isEmpty returns true for the value.

Other validators use allowBlank in combination with an isBlank check, and allowNone for an isEmpty check. This is inconsistent; blank should always mean blank, and empty/none should always mean empty.

There may be other validators with this problem, but I haven't checked.

Should this be fixed, and if so, how? One option is to deprecate the current allowBlank option in favor of allowNone, which would behave the same way. At the next major release, you could then add a real allowBlank option if desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions