34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/chronic/repeaters/repeater_fortnight.rb', line 34
def this(pointer = :future)
super
pointer = :future if pointer == :none
case pointer
when :future
this_fortnight_start = Time.construct(@now.year, @now.month, @now.day, @now.hour) + Chronic::RepeaterHour::HOUR_SECONDS
sunday_repeater = Chronic::RepeaterDayName.new(:sunday)
sunday_repeater.start = @now
sunday_repeater.this(:future)
this_sunday_span = sunday_repeater.this(:future)
this_fortnight_end = this_sunday_span.begin
Chronic::Span.new(this_fortnight_start, this_fortnight_end)
when :past
this_fortnight_end = Time.construct(@now.year, @now.month, @now.day, @now.hour)
sunday_repeater = Chronic::RepeaterDayName.new(:sunday)
sunday_repeater.start = @now
last_sunday_span = sunday_repeater.next(:past)
this_fortnight_start = last_sunday_span.begin
Chronic::Span.new(this_fortnight_start, this_fortnight_end)
end
end
|