Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Range" data type #4535

Open
dkarlovi opened this issue Jun 18, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@dkarlovi
Copy link

commented Jun 18, 2019

Feature Request

  • There is no existing issue regarding the same topic

Feature description

Range

Adding a new data type Range would allow to model attributes meant to hold two values.

Examples include:

  • weight for child diapers (6kg - 10kg)
  • age for toys (2yr - 5yr)
  • operational temperature (-30°C - 40°C)

etc.

Note: this is not the same as existing min/max values because they're used to constrain a single value, this is meant to specify min/max as a single property. We should still have min/max to constrain (lower end must be >= min, <= higher end, higher end must be <= max).

QuantityRange

Same as above, with a (single) unit attached. Since all my examples actually include units, this makes more sense to have, but for completeness sake, I've included the plain Range type too.

@aarongerig

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

Another type could be ...

DateRange

... which returns a CarbonPeriod object.

@dkarlovi dkarlovi changed the title "Range" date type "Range" data type Jun 18, 2019

@Yivan

This comment has been minimized.

Copy link
Contributor

commented Jun 18, 2019

Hello @aarongerig
I like pretty much the idea to have new "range" data type for number and for dates.
Dates especially because this is a pain actually for project where you need to manage booking for instance ; )

Actually the work around are two fieds and check in the save of the model the value are coherent, if not send an error message. You can do it in preSave event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.