Refactor db_helper_compare_days()

Proposed fix for https://www.mantisbt.org/bugs/view.php?id=17980

I have not fully tested this.
Negative values can easily be covered by inverting the comparison...
`a < b - 1` == `b < a + 1`

Would you rather add a check that throws an error / warning, or rewrites the condition if `( $p_value_2 + $p_duration )` is negative ?