Skip to content

Add validate_between for numbers and Time #1146

@jwoertink

Description

@jwoertink

This would allow you to validate that either a number or a Time based column sits between some lower bounds and some upper bounds.

Something like this

validate_between age, min: 30, max: 60
validate_between coupon, min: 2.days.ago, max: 2.days.from_now

We actually already have validate_numeric for validating that a number is within some range, so we could just make this for Time only, but I figure someone might reach for a number and wonder why it didn't work... We wouldn't get rid of validate_numeric though because with that you can set only a min or only a max and not care about the other bounds. With this you want to ensure that it's directly between the two.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions