Author: Kodi Date: 2010-07-14 23:18:42 +0200 (Wed, 14 Jul 2010) New Revision: 31689
Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod Log: [S32/Temporal] Permit days-in-month and is-leap-year on DateTimes, too. Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod =================================================================== --- docs/Perl6/Spec/S32-setting-library/Temporal.pod 2010-07-14 20:35:20 UTC (rev 31688) +++ docs/Perl6/Spec/S32-setting-library/Temporal.pod 2010-07-14 21:18:42 UTC (rev 31689) @@ -16,7 +16,7 @@ Created: 19 Mar 2009 Last Modified: 14 Jul 2010 - Version: 12 + Version: 13 The document is a draft. @@ -157,9 +157,17 @@ month, the day itself included. For example, June 9, 2003 is the second Monday of the month, and so this method returns 2 for that day. +The C<days-in-month> method returns the number of days in the current +month of the current year. So in the case of January, C<days-in-month> +always returns 31, whereas in the case of February, C<days-in-month> +returns 28 or 29 depending on the year. + The C<day-of-year> method returns the day of the year, a value between 1 and 366. +The method C<is-leap-year> returns a C<Bool>, which is true if and only +if the current year is a leap year in the Gregorian calendar. + The method C<whole-second> returns the second truncated to an integer. The C<Date> method returns a C<Date> object, and is the same as @@ -232,20 +240,23 @@ =head2 Accessors -The following accessors are pretty obvious, and are defined by example only. -See the test suite for more formal definitions. +C<Date> objects support all of the following accessors, which work just +like their C<DateTime> equivalents: - my $d = Date.new('2010-12-24'); - $d.year # 2010 - $d.month # 12 - $d.day # 24 - $d.day-of-week # 5 # Friday - $d.is-leap-year # Bool::False - $d.days-in-month # 31 - $d.Str # '2010-12-24' + year + month + day + day-of-week + week + week-year + week-number + day-of-week + weekday-of-month + days-in-month + day-of-year + is-leap-year -There are also C<week>, C<week-year>, C<week-number>, C<weekday-of-month>, -and C<day-of-year> methods, which work just like their DateTime equivalents. +The <Str> method returns a string of the form 'yyyy-mm-dd'. =head2 Arithmetics