File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 79
79
Returns C < True > if C < $year > is a leap year. Can be called as a class method
80
80
if the year is provided.
81
81
82
+ say Dateish.is-leap-year(2016); # True
83
+ say Date.new("1900-01-01").is-leap-year; # False
84
+
82
85
= head2 method day-of-month
83
86
84
87
Defined as:
@@ -130,6 +133,9 @@ Returns the number of days in a month, where year and month default to that
130
133
of the invocant. If both year and month are provided, it can be called as
131
134
a class method.
132
135
136
+ say Date.new("2016-01-02").days-in-month; # 31
137
+ say Dateish.days-in-month(2016, 1); # 31
138
+
133
139
= head2 method week
134
140
135
141
Defined as:
@@ -148,6 +154,25 @@ at the start or end of a year, the week may actually belong to the other year.
148
154
say $week; # 1
149
155
say Date.new('2015-01-31').week; # 2015 5
150
156
157
+ = head2 method week-number
158
+
159
+ Defined as:
160
+
161
+ method week-number(Date:D:) returns Int:D
162
+
163
+ Usage:
164
+
165
+ Dateish.week-number
166
+
167
+ Returns the week number (1..53) of the date specified by the invocant. The first
168
+ week of the year is defined by ISO as the one which contains the fourth day of
169
+ January. Thus, dates early in January often end up in the last week of the prior
170
+ year, and similarly, the final few days of December may be placed in the first
171
+ week of the next year.
172
+
173
+ say Date.new("2014-12-31").week-number; # 1 (first week of 2015)
174
+ say Date.new("2016-01-02").week-number; # 53 (last week of 2015)
175
+
151
176
= head2 method weekday-of-month
152
177
153
178
Defined as:
You can’t perform that action at this time.
0 commit comments