We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 524a1ac commit 1476c8aCopy full SHA for 1476c8a
README.adoc
@@ -1808,6 +1808,23 @@ date.all_quarter
1808
date.all_year
1809
----
1810
1811
+=== Time Comparison
1812
+
1813
+Use `past?` and `future?` methods instead of comparing time to the current time.
1814
1815
+[source,ruby]
1816
+----
1817
+# bad
1818
+grand_opening_at < Time.current
1819
+public_release_at > Time.current
1820
1821
+# good
1822
+grand_opening_at.past?
1823
+public_release_at.future?
1824
1825
1826
+NOTE: Rails 6.0 and later also provide `before?` and `after?` methods to compare two arbitrary time objects.
1827
1828
== Duration
1829
1830
=== Duration Application
0 commit comments