Fuzzy Dates is designed to store date values within a specified amount of accuracy. Each date is stored as a range and a descriptor, so that programmatic operations can still be performed, while providing a user-friendly label.
Add this line to your application's Gemfile:
gem "fuzzy_dates"And then execute:
$ bundle installOr install it yourself as:
$ gem install fuzzy_datesclass MyModel < ApplicationRecord
include FuzzyDates::FuzzyDateable
has_fuzzy_dates :start_date, :end_date
endclass MyModelsSerializer < BaseSerializer
index_attributes :id, :name, start_date: FuzzyDates::FuzzyDateSerializer, end_date: FuzzyDates::FuzzyDateSerializer
show_attributes :id, :name, start_date: FuzzyDates::FuzzyDateSerializer, end_date: FuzzyDates::FuzzyDateSerializer
endThe gem is available as open source under the terms of the MIT License.