File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1736,6 +1736,28 @@ Time.zone.now # => Fri, 12 Mar 2014 22:04:47 EET +02:00
17361736Time.current # Same thing but shorter.
17371737----
17381738
1739+ === Prefer `all_(day|week|month|quarter|year)` over range of date/time [[date-time-range]]
1740+
1741+ Prefer `all_(day|week|month|quarter|year)` over `beginning_of_(day|week|month|quarter|year)..end_of_(day|week|month|quarter|year)`
1742+ to get the range of date/time.
1743+
1744+ [source,ruby]
1745+ ----
1746+ # bad
1747+ date.beginning_of_day..date.end_of_day
1748+ date.beginning_of_week..date.end_of_week
1749+ date.beginning_of_month..date.end_of_month
1750+ date.beginning_of_quarter..date.end_of_quarter
1751+ date.beginning_of_year..date.end_of_year
1752+
1753+ # good
1754+ date.all_day
1755+ date.all_week
1756+ date.all_month
1757+ date.all_quarter
1758+ date.all_year
1759+ ----
1760+
17391761== Duration
17401762
17411763=== Duration Application
You can’t perform that action at this time.
0 commit comments