lib/by_star/kernel.rb in by_star-2.2.0.rc1 vs lib/by_star/kernel.rb in by_star-2.2.0
- old
+ new
@@ -16,17 +16,17 @@
end
# A "Fortnight" is defined as a two week period, with the first fortnight of the
# year beginning on 1st January.
def beginning_of_fortnight
- beginning_of_year + ((self - beginning_of_year) / 2.weeks).to_i * 2.weeks
+ (beginning_of_year.to_date + 14 * ((self - beginning_of_year) / 2.weeks).to_i).beginning_of_day
end
def end_of_fortnight
- (beginning_of_fortnight + 13.days).end_of_day
+ (beginning_of_fortnight.to_date + 13).end_of_day
end
- # A "Calendar Month" is defined as a month as it appears on a calendar, including days
+ # A "Calendar Month" is defined as a month as it appears on a calendar, including days form
# previous/following months which are part of the first/last weeks of the given month.
def beginning_of_calendar_month(*args)
beginning_of_month.beginning_of_week(*args)
end