[Koha-bugs] [Bug 17699] DateTime durations are not correctly subtracted

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 22 14:53:21 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17699

--- Comment #6 from M. Tompsett <mtompset at hotmail.com> ---
(In reply to Jonathan Druart from comment #5)
> Just redone some tests and indeed limit seems like to be what we want:
[SNIP]
> Wondering why 'limit' does not work as default...

You'd have to ask the developer of the module. :)

"For positive durations, the
' "end_of_month" parameter defaults to wrap. For negative durations, the
default is "limit". This should match how most people "intuitively" expect
datetime math to work. ' -- DateTime::Duration perl

Perhaps we uncovered a bug in the method?

"date vs datetime math
If you only care about the date (calendar) portion of a datetime, you should
use either delta_md() or delta_days(), not subtract_datetime(). This will give
predictable, unsurprising results, free from DST-related complications." --
http://search.cpan.org/~drolsky/DateTime-1.42/lib/DateTime.pm#How_DateTime_Math_Works

Perhaps we shouldn't be taking the 'to_days' way of doing the math?

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list