moneybird / active-date-range

Powerful DateRanges for Ruby and ActiveSupport
MIT License
51 stars 0 forks source link

Support for boundless ranges #5

Closed edwinv closed 3 years ago

edwinv commented 3 years ago

In some scenario, you might have a date range without a start of end. With this PR we are adding support for boundless ranges:

date_range = DateRange.parse('202101..')
date_range.boundless? # => true
date_range.in_groups_of(:month) # => Enumerator::Lazy
Model.where(date: date_range) # => SQL "WHERE date >= 2021-01-01"