Skip to content

Commit

Permalink
by_fortnight should go to the end of the day at the end of the fortnight
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Feb 19, 2012
1 parent a8ebfdb commit 6fc23fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/by_star/by_fortnight.rb
Expand Up @@ -20,7 +20,7 @@ def by_fortnight_Time_or_Date(time, options={})
# The first fortnight of the year should of course start on the 1st January,
# and not the beginning of that week.
start_time = time.beginning_of_year + (time.strftime("%U").to_i - 1).weeks
between(start_time, start_time + 2.weeks, options)
between(start_time, (start_time + 2.weeks).end_of_day, options)
end
alias_method :by_fortnight_Time, :by_fortnight_Time_or_Date
alias_method :by_fortnight_Date, :by_fortnight_Time_or_Date
Expand All @@ -30,7 +30,7 @@ def by_fortnight_String_or_Fixnum(weeks, options={})
current_time = Time.zone.local(options[:year] || Time.zone.now.year)
if weeks <= 26
start_time = current_time + (weeks * 2).weeks
between(start_time, start_time + 2.weeks, options)
between(start_time, (start_time + 2.weeks).end_of_day, options)
else
raise ParseError, "by_fortnight takes only a Time, Date or a Fixnum (less than or equal to 26)."
end
Expand Down

0 comments on commit 6fc23fb

Please sign in to comment.