lib/parsi-date.rb in parsi-date-0.3.0 vs lib/parsi-date.rb in parsi-date-0.3.1
- old
+ new
@@ -583,10 +583,11 @@
to_gregorian.cwday
end
# Returns the calendar week number (1-53).
def cweek
- (jd - Date.send(:first_day_of_year, year)) / 7 + 1
+ start = Date.civil(year, 1, 1)
+ ((jd - start.jd + start.cwday - 5) / 7.0).ceil
end
# Return a new Date object that is +n+ months earlier than the current one.
#
# If the day-of-the-month of the current Date is greater than the last day of