week-number
ErrorsCollection

week-number

Synthesised documentation from type/Dateish

From type/Dateish

See Original text in context

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

Returns the week number (1..53) of the date specified by the invocant. The first week of the year is defined by ISO as the one which contains the fourth day of January. Thus, 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("2014-12-31").week-number;   # 1  (first week of 2015) 
say Date.new("2016-01-02").week-number;   # 53 (last week of 2015)