Commit 4da7d1212536f38fcc42d980befae36d8bce7ad5
1 parent
3c8d42e0
Exists in
master
and in
10 other branches
Version bump to 2.5.2
Showing
3 changed files
with
20 additions
and
3 deletions
Show diff stats
CHANGELOG.md
README.md
... | ... | @@ -136,7 +136,24 @@ or |
136 | 136 | User.group_by_day(:created_at).order("day desc").count |
137 | 137 | ``` |
138 | 138 | |
139 | -### Format | |
139 | +### Keys | |
140 | + | |
141 | +To get keys as date objects instead of time objects, use: | |
142 | + | |
143 | +```ruby | |
144 | +User.group_by_day(:created_at, dates: true).count | |
145 | +# { | |
146 | +# 2013-03-10 => 70, | |
147 | +# 2013-03-17 => 54, | |
148 | +# 2013-03-24 => 80 | |
149 | +# } | |
150 | +``` | |
151 | + | |
152 | +or make this the default with: | |
153 | + | |
154 | +```ruby | |
155 | +Groupdate.dates = true | |
156 | +``` | |
140 | 157 | |
141 | 158 | To get keys in a different format, use: |
142 | 159 | ... | ... |
lib/groupdate/version.rb