chansen / p5-time-moment

Time::Moment represents an exact moment in time.
32 stars 8 forks source link

Add days diff support #9

Closed ghost closed 8 years ago

ghost commented 9 years ago

Please check: https://github.com/chansen/p5-time-moment/pull/8

chansen commented 9 years ago

I would like to thank you for your contribution, but I need to give this thoughts. I'll probably use a prefix that is consistent with with, plus and minus methods, such as delta$unit.

chansen commented 9 years ago

Since neither of the above mentioned methods accepts fractional values, I don't think a difference method should return fractional values.

ghost commented 9 years ago

Well. So what you propose? Can you add something like this? I really need method that can return days between two dates. Thank you!

chansen commented 9 years ago

I'll add support for a duration and a couple of methods to query for duration of time between instants.

$hours = $tm1->delta_hours($tm2); $minutes = $tm1->delta_minutes($tm2); $seconds = $tm1->delta_seconds($tm2); ...

chansen commented 8 years ago

I have released Time::Moment v31 to CPAN, which has a delta_days method.

ghost commented 8 years ago

Nice! Thank you!