Reports Screen Shows Current Month as Last Month Under Specific Circumstances
Posted: Sun Nov 05, 2017 4:16 pm
This issue was originally reported on the Mods for HESK issue tracker (https://gitlab.com/mike-koch/Mods-for-HESK/issues/587); however it applies to HESK as well.
When viewing the reports page, "Last Month" will be the current month if you are accessing the page on the 31st day of the month and the previous month does not have 31 days (i.e. viewing the reports page on October 31st will show last month as October as PHP tries to get the month for 2017-09-31, which rolls over to 2017-10-01).
A possible solution would be to set the current date to the first of the month, and then use strtotime('last month').
When viewing the reports page, "Last Month" will be the current month if you are accessing the page on the 31st day of the month and the previous month does not have 31 days (i.e. viewing the reports page on October 31st will show last month as October as PHP tries to get the month for 2017-09-31, which rolls over to 2017-10-01).
A possible solution would be to set the current date to the first of the month, and then use strtotime('last month').