Issue with DateTime::Span->from_datetime_and_duration()

[email protected] (David Pottage) Tue, 27 Aug 2013 10:02:41 +0100
Newsgroups perl.datetime
Message-ID <[email protected]>
Hello

I am attempting to create a number of DateTime::Span objects for the 
past hour, past 24 hours, past week etc. The code I am using looks like 
this:

     my $last24hours = DateTime::Span->from_datetime_and_duration(
         end      => DateTime->now(),
         duration => DateTime::Duration->new( hours => 24 ),
     );

The code is not working as expected. Instead, I am getting a 24 hour 
time span from now into the future rather than into the past.

I have had a peek at the source code for from_datetime_and_duration(), 
and it looks like it always adds the duration to the supplied DateTime 
regardless of weather it is supplied as a start or end.

Is this a bug? I can supply a test case or patch if necessary.

-- 
David Pottage
CV Library Ltd.