[Koha-bugs] [Bug 24608] Allow modification of checkout due date

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Mar 5 12:59:41 CET 2020


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

--- Comment #29 from Andrew Isherwood <andrew.isherwood at ptfs-europe.com> ---
(In reply to Jonathan Druart from comment #26)

Hi Jonathan

> When I edit I pick 23:59 but 22:59 is saved. Then edit again, save without
> modifying anything, 21:59 is saved, and so on.

I can't replicate this. So, you're selecting a date, default time is 23:59, but
when you save, 22:59 is saved? Is that the value sent by the API call, or the
value that's returned by the API? As I say, I can't replicate this, it works
fine for me.

> If I edit the date and remove the time page, save, it's loading endlessly.
> Which means 1. errors are not handled correctly, and 2. date only formatted
> dates are not taken into account.

The "loading endlessly" is actually the JS falling over because the call to
DateTime_from_syspref is failing because DateTime_from_syspref doesn't check
what it's got before trying to split it. So it splits the received string by "
", then tries to split the second part of that by ":" which of course fails
because the second part is null.

Having considered this for a while, I'm not clear of the best way forward, it
potentially opens a can of worms. We could say that DateTime_from_syspref
should validate what it's got before working with it, and if it fails
validation, it should error. We have date validation with accompanying errors
in the form of calendar.inc's validate_date, so it would be reasonable to say
we need similar time validation. However, if we're doing that, should we not be
adding that to the upcoming moment.js work in Bug 24455 since that uses
moment.js for date formatting, it should probably be leveraging moment.js' date
& time validation. But if we do that with the time component, should we not
also switch the date validation that's currently in calendar.inc to using
moment.js.

Maybe I'm overcomplicating, but that was my thought process. I don't want to
just put a hack in, but at the same time, doing it "properly" could be a pain
in the ass.

Any thoughts?

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


More information about the Koha-bugs mailing list