Commit 7adfdd774ec21b2555d403f1bbba895ddf97f6e5

Authored by Andrew Kane
1 parent 080fab87

Fixed current: false

Showing 2 changed files with 12 additions and 2 deletions   Show diff stats
CHANGELOG.md
  1 +## 3.1.1 [unreleased]
  2 +
  3 +- Fixed `current: false`
  4 +- Fixed `last` with `group_by_quarter`
  5 +
1 6 ## 3.1.0
2 7  
3 8 - Better support for date columns with `time_zone: false`
... ...
lib/groupdate/magic.rb
... ... @@ -189,13 +189,18 @@ module Groupdate
189 189 end
190 190 if step
191 191 now = Time.now
192   - now -= step if options[:current] == false
193 192 # loop instead of multiply to change start_at - see #151
194 193 start_at = now
195 194 (options[:last].to_i - 1).times do
196 195 start_at -= step
197 196 end
198   - time_range = round_time(start_at)..now
  197 +
  198 + time_range =
  199 + if options[:current] == false
  200 + round_time(start_at - step)...round_time(now)
  201 + else
  202 + round_time(start_at)..now
  203 + end
199 204 end
200 205 end
201 206 time_range
... ...