Skip to content

Commit

Permalink
Merge pull request #319 from koic/add_new_date_time_range_rule
Browse files Browse the repository at this point in the history
Add new "Prefer `all_(day|week|month|quarter|year)` over range of date/time" rule
  • Loading branch information
koic authored Jul 1, 2022
2 parents f31e7a1 + eefb72a commit 3d59910
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,28 @@ Time.zone.now # => Fri, 12 Mar 2014 22:04:47 EET +02:00
Time.current # Same thing but shorter.
----

=== Prefer `all_(day|week|month|quarter|year)` over range of date/time [[date-time-range]]

Prefer `all_(day|week|month|quarter|year)` over `beginning_of_(day|week|month|quarter|year)..end_of_(day|week|month|quarter|year)`
to get the range of date/time.

[source,ruby]
----
# bad
date.beginning_of_day..date.end_of_day
date.beginning_of_week..date.end_of_week
date.beginning_of_month..date.end_of_month
date.beginning_of_quarter..date.end_of_quarter
date.beginning_of_year..date.end_of_year
# good
date.all_day
date.all_week
date.all_month
date.all_quarter
date.all_year
----

== Duration

=== Duration Application
Expand Down

0 comments on commit 3d59910

Please sign in to comment.