https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30059 --- Comment #8 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- The problem is the timezone, not the calculation. I don't think we need a lib for that. (In reply to Martin Renvoize from comment #4)
Might be an unpopular view.. but don't we already pull in moment.js for other date manipulations.. so couldn't we use https://momentjs.com/docs/#/displaying/difference/ to get a rather accurate result?
I didn't manage to make it work, I get "tz is not a function". I've tried with moment-timezone as well, and both with the latest version. Also worth noting: "Moment.js is a legacy project, now in maintenance mode. In most cases, you should choose a different library.", from https://github.com/moment/moment (In reply to Tomás Cohen Arazi from comment #7)
In that case, I'd just allow embedding the age like in:
GET /patrons x-koha-emebed: age
(it would require renaming the ->get_age method)
I had that concern some months ago (we will have twice the same business logic), but we agreed on providing a "JS equivalent" (bug 28874). Here it's over-complicating things anyway, we just want to subtract two dates. We can also rely on the client to make extra processing, which is good for server perfs. -- You are receiving this mail because: You are watching all bug changes.