So, one of the peculiarities of DateTime maths is that 12 plus 1 doesn't always equal 13 ;) This calls for an example (using 'limit' for end_of_month mode): 2019-01-31 + 1 month = 2019-02-28 2019-01-31 + 13 months = 2020-02-29 (this one maintains 'end of month' over the leap year) 2019-02-28 + 12 months = 2020-02-28 Koha does the third case but the test is currently setup for the second.
Created attachment 84599 [details] [review] Bug 22254: Correction to datehandling in test Adding 13 months is not always the same as adding 1 month and then adding 12 months in DateTime maths. This patch rectified the test to match the correct behaviour in koha.
Test plan. 1) Modify the test (around line 268) to test against the suspect leap date of 2019-01-31 and watch the test fail. 2) Apply the patch (which also adds this modification to test for such a leap date) and watch the test now pass.
Created attachment 84600 [details] [review] Bug 22254: Correction to datehandling in test Adding 13 months is not always the same as adding 1 month and then adding 12 months in DateTime maths. This patch rectified the test to match the correct behaviour in koha. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 84677 [details] [review] Bug 22254: Correction to datehandling in test Adding 13 months is not always the same as adding 1 month and then adding 12 months in DateTime maths. This patch rectified the test to match the correct behaviour in koha. Test plan. 1) Modify the test (around line 268) to test against the suspect leap date of 2019-01-31 and watch the test fail. 2) Apply the patch (which also adds this modification to test for such a leap date) and watch the test now pass. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Awesome work all! Pushed to master for 19.05
Pushed to 18.11.x for 18.11.03
backported to 18.05.x for 18.05.09
Good catch Martin. I would have added more dates, like: + for my $date ( '2016-03-31', '2016-11-30', '2019-01-31', '2020-02-28', '2020-01-31', '2020-02-29', dt_from_string() ) { Just in case ;)
Pushed to 17.11.x for 17.11.16