diff --git a/CHANGELOG.md b/CHANGELOG.md index 8746b37..840e2f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.5.2 [unreleased] +## 2.5.2 - Added `dates` option to return dates for day, week, month, quarter, and year diff --git a/README.md b/README.md index 6914e85..e7d8e3b 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,24 @@ or User.group_by_day(:created_at).order("day desc").count ``` -### Format +### Keys + +To get keys as date objects instead of time objects, use: + +```ruby +User.group_by_day(:created_at, dates: true).count +# { +# 2013-03-10 => 70, +# 2013-03-17 => 54, +# 2013-03-24 => 80 +# } +``` + +or make this the default with: + +```ruby +Groupdate.dates = true +``` To get keys in a different format, use: diff --git a/lib/groupdate/version.rb b/lib/groupdate/version.rb index f9b59a1..3054d4d 100644 --- a/lib/groupdate/version.rb +++ b/lib/groupdate/version.rb @@ -1,3 +1,3 @@ module Groupdate - VERSION = "2.5.1" + VERSION = "2.5.2" end -- libgit2 0.21.0