Skip to content

Instantly share code, notes, and snippets.

@leejarvis
Created August 16, 2011 16:16
Show Gist options
  • Save leejarvis/8bf03db18e90afe0a047 to your computer and use it in GitHub Desktop.
Save leejarvis/8bf03db18e90afe0a047 to your computer and use it in GitHub Desktop.
diff --git a/lib/chronic/repeaters/repeater_day_portion.rb b/lib/chronic/repeaters/repeater_day_port
index 651cfd0..73f187f 100644
--- a/lib/chronic/repeaters/repeater_day_portion.rb
+++ b/lib/chronic/repeaters/repeater_day_portion.rb
@@ -66,8 +66,13 @@ module Chronic
def this(context = :future)
super
- range_start = Chronic.construct(@now.year, @now.month, @now.day) + @range.begin
- @current_span = Span.new(range_start, range_start + (@range.end - @range.begin))
+ if context == :past
+ range_start = Chronic.construct(@now.year, @now.month, @now.day - 1) + @range.begin
+ else
+ range_start = Chronic.construct(@now.year, @now.month, @now.day) + @range.begin
+ end
+
+ Span.new(range_start, range_start + (@range.end - @range.begin))
end
def offset(span, amount, pointer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment