Author: moritz
Date: 2010-04-18 13:17:58 +0200 (Sun, 18 Apr 2010)
New Revision: 30403

Modified:
   docs/Perl6/Spec/S32-setting-library/Temporal.pod
Log:
[S32::Temporal] Date <-> DateTime integration

* DateTime constructor which takes a Date object, as suggested by Mark J. Reed
* DateTime.Date coercion method
* Remove DateTime.today, since date-only calculations are meant be done by the
  Date class
* Date.new() constructor taking a DateTime object

Modified: docs/Perl6/Spec/S32-setting-library/Temporal.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Temporal.pod    2010-04-17 22:04:13 UTC 
(rev 30402)
+++ docs/Perl6/Spec/S32-setting-library/Temporal.pod    2010-04-18 11:17:58 UTC 
(rev 30403)
@@ -67,19 +67,6 @@
 
     my $now = DateTime.now();
 
-If you're interested in the current date but not the time, you can use
-the C<today> method instead:
-
-    my $today = DateTime.today();
-
-This has the same effect as doing C<DateTime.now().truncate('day')>; see
-'"Set" methods' below.
-
-Or if you want to extract the date as a C<Date> object (see below),
-you can use simple type coercion:
-
-    my $today = $datetime.Date;
-
 General dates can be specified through the C<new> constructor:
 
     my $moonlanding = DateTime.new( :year(1969), :month(7), :day(16),
@@ -96,6 +83,10 @@
     :timezone   defaults to '+0000' (UTC)
     :formatter  defaults to an iso8601 formatter, see below
 
+Another multi exists with C<Date :date>
+instead of C<:year>, C<:month> and C<:day> (and the same defaults as listed
+above).
+
 A shorter way to send in date and time information to is providing a
 single string with a full ISO8601 date and time. The example from above
 would then be
@@ -156,6 +147,9 @@
 The single argument of each of those methods is optional, but the above
 shows the defaults: C<'-'> for dates and C<':'> for times.
 
+The C<Date> method returns a C<Date> object, and is the same as
+C<Date.new(|$dt.ymd)>.
+
 The C<timezone> method returns the C<DateTime::TimeZone> object for the
 C<DateTime> object. The method C<offset> returns the offset from UTC, in
 seconds, of the C<DateTime> object according to the time zone.
@@ -203,14 +197,15 @@
 
 =head1 Date
 
-C<Date> objects represent a day without a time component, and allow easier
-manipulation by assuming that integers always mean days.
+C<Date> objects are immutable and represent a day without a time component.
+They allow easier manipulation by assuming that integers always mean days.
 
 Days, Months and days of week are 1-based.
 
 =head2 Constructors
 
     Date.today();               # today's date
+    Date.new(DateTime.now);     # same
     Date.new('2010-12-24');     # YYYY-MM-DD format
     Date.new(:year(2010), :month(12), :day(24));
     Date.new(2010, 12, 24);

Reply via email to