Comment 1 for bug 1635737

Revision history for this message
Bill Erickson (berick) wrote :

Here's an experiment that calculates due dates based on what was discussed in IRC:

http://irc.evergreen-ils.org/evergreen/2016-10-21#i_273165

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1635737-due-date-interval-smarts

This has a number of problems, though. The normalization step, that cross-walks the duration string between interval_to_seconds then seconds_to_interval causes loss of information. For example, "30 days" becomes "1 month 14 hours" which, depending on when it's applied (e.g Feb 1), could be several days shy of "30 days".

I believe we either have the make the Perl interval parsing essentially as smart as PG's interval handling or ask PG to calculate the date for us.

On interesting side effect of this general approach -- honoring the lengths of various duration components based on when the components are applied -- means that we could create duration rules for 1 month and have the due dates always fall on the same day the following month, instead of falling exactly 30 days later regardless of what month it is. And in cases where that's not desired, using day-based durations will still behave as expected.