SimpleMachines/SMF2.1 — pull request #1264 by Labradoodle-360 (2014-01-23 20:57:42+00:00)
Title: Calendar - Min/Max Year Fix (#1249)

- $current_month_started now is conditioned with empty() rather than
=== since it's only a bool if not set; otherwise it's set to $count, so
an integer. (Maybe this should be a bool then realistically?)

- Added proper condition to elseif statement.

When the code was originally written, line 287 used to be an else, not
an elseif. If the current month hadn't started, it was still the
previous month in that week. Otherwise, if the current month HAD
started and the loop had finished the days, but there were slots left
in the grid, it would feed the next few days from the NEXT month.

When the condition was updated to fix the undefined errors that I so
foolishly overlooked, the condition was not fully understood. It was
changed to: "IF the current month isn't started and there's a previous
grid THEN show the previous days OR if there is a next month grid THEN
show it.

The gap in this logic is that if there is a next grid, it should only
be shown AFTER the main grid loop is completed - which is where NOW the
additional condition comes in and is much necessary
(!empty($current_month_started)).

Which is why for instance if you were on January 2008 (default minimum)
it would show "February 1, 2" ahead of January, because "February 1, 2"
are the first elements of calendar_grid_next.

This fixes #1249.

Signed-Off: Matthew P. Kerle / Labradoodle-360
(creativewebdsign@gmail.com)