Skip to content

Commit 3d59910

Browse files
authored
Merge pull request #319 from koic/add_new_date_time_range_rule
Add new "Prefer `all_(day|week|month|quarter|year)` over range of date/time" rule
2 parents f31e7a1 + eefb72a commit 3d59910

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.adoc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,28 @@ Time.zone.now # => Fri, 12 Mar 2014 22:04:47 EET +02:00
17361736
Time.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

0 commit comments

Comments
 (0)