Rails 6 adds
after? methods to
< as “greater than” and “less than” in ruby.
after? methods make the date/time comparisons much more human-readable.
We can compare two date or time objects using
This is not so easy to read. We read it as
Date.tomorrow is “greater than”
before? and after? methods
When comparing dates in English, one would say:
The due date for the assignment is before the end of the month. All submissions after the end date will be ignored.
To match these, we now have
after? comparison methods in
We can now compare date and time values like so:
The comparison is now much more readable and reads like: Is due date before today or after today?