Subject: | + -2 hours |
Arithmetic in Perl (and other languages) allows a unary minus, e.g.
% perl -E 'say 10 + -2'
8
However this isn't accepted by DateCalc:
% perl -MDate::Manip -E 'say DateCalc("now", "+ -2 hours")'
It should allow unary + and - on the right hand side of the binary + or - operator.
This would be particularly useful when generating the calculation:
DateCalc($d, "+ $h hours")
where $h might be positive or negative.
I understand that it works to omit the leading +, but I suggest the explicit + is a bit clearer, and if it can be given some of the time it should work all of the time.