See Original text in context
method week-year(Date: --> Int)
Returns the week year of the date specified by the invocant. Normally week-year
is equal to Date.year
. Note however that dates early in January often end up in the last week of the prior year, and similarly, the final few days of December may be placed in the first week of the next year.
say Date.new("2015-11-15").week-year; # 2015say Date.new("2014-12-31").week-year; # 2015 (date belongs to the first week of 2015)say Date.new("2016-01-02").week-year; # 2015 (date belongs to the last week of 2015)