I want to create a duration that represents 3 hours shy of 3 months.
There is no way to do this directly using the new() constructor (Date::Manip
has 2 effective signs, one on years and months and the other on weeks,
days, hours, minutes and seconds).
You can get this by doing:
--
my $dur = DateTime::Duration->new(months => 3);
$dur->add(hours => -3);
--
The nits:
1) The following doesn't work because add_duration() doesn't return
the object, but rather falls through and returns the number of
nanoseconds in the final object:
--
my $dur = DateTime::Duration->new(months => 3)->add(hours => -3);
--
2) Having a way to construct this directly would be nice being able
to make a duration that you can not directly construct seems odd.
-ben