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
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.
CV Library Ltd.