method week-year

Documentation for method week-year assembled from the following types:

role Dateish

From Dateish

(Dateish) method week-year

Defined as:

method week-year(Date:D: --> Int:D)

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;   # 2015 
say 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)