[dev.icinga.com #11147] "day -X" time specifications are parsed incorrectly #3932
This issue has been migrated from Redmine: https://dev.icinga.com/issues/11147
Created by atj on 2016-02-11 15:40:15 +00:00
Based on the available documentation, time specifications of the form "day -1" should be parsed as "the last day of the month". However LegacyTimePeriod::ParseTimeSpec currently parses "day -1" as the second to last day of the month. This is due to the following code (repeated a couple of times):
The decrementing of
My suggestion would be to add a method to return the number of days in a month, so the code looked something like:
Please let me know if this is acceptable and I will write a patch.
2016-05-11 07:23:55 +00:00 by gbeutner ed27130
2016-05-12 09:09:49 +00:00 by gbeutner 89c7b5a
Updated by gbeutner on 2016-05-11 06:52:21 +00:00
The mktime(3) manpage seems to suggest that this is in fact supported:
However, obviously "day-1" should refer to the last day - as opposed to the second-to-last day, so this is definitely still a bug.