DateTime::Span - a span created with before has the same range as a span created with end

[email protected] (Terrence Brannon)
Newsgroups perl.datetime
Message-ID <[email protected]>
Intuitively, it would seem that specifying the 'before' of a datetime
span using the end option of the ->from_datetimes() constructor would
yield a range that is 1 second (1 nanosecond?) earlier than the actual
date supplied.

But as it is stands, the end of a range specified using the 'before'
option is the same as one specified using the 'end' option:


use strict; use warnings;

use DateTime;
use DateTime::Span;


my $dt1 = DateTime->new( year => 2002, month => 3, day => 11 );
my $dt2 = DateTime->new( year => 2003, month => 4, day => 12 );

my $span  = DateTime::Span->from_datetimes( start => $dt1, before => $dt2 );


warn 'start: ' . $span->start . ' end: ' .  $span->end;

my $span  = DateTime::Span->from_datetimes( start => $dt1, end => $dt2 );

warn 'start: ' . $span->start . ' end: ' .  $span->end;  ### same
output as with 'before'
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.