Off-by-one error on non-existant days
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #113959. --> Reported by: [Crell](https://www.drupal.org/user/26398) >>> <p>The _calendar_make_node() function does not properly account for days that do not exist. For instance, on January 29th (when I'm submitting this) if I try to view the month block for February, it tries to create a timestamp for February 29th, which doesn't exist this year, and so returns March 1st, causing the block to display the calendar for March. </p> <p>I'm at work so once again can't roll a real patch, but here's what I did to fix it. Right before the line:</p> <div class="codeblock"> <pre><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br>&nbsp;$timestamp </span><span style="color: #007700">= </span><span style="color: #0000BB">gmmktime</span><span style="color: #007700">(</span><span style="color: #0000BB">$hour</span><span style="color: #007700">, </span><span style="color: #0000BB">$minute</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">$month</span><span style="color: #007700">, </span><span style="color: #0000BB">$day</span><span style="color: #007700">, </span><span style="color: #0000BB">$year</span><span style="color: #007700">); <br></span><span style="color: #0000BB">?&gt;</span></span></pre></div> <p>Add this:</p> <div class="codeblock"> <pre><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br>&nbsp;</span><span style="color: #007700">while (!</span><span style="color: #0000BB">checkdate</span><span style="color: #007700">(</span><span style="color: #0000BB">$month</span><span style="color: #007700">, </span><span style="color: #0000BB">$day</span><span style="color: #007700">, </span><span style="color: #0000BB">$year</span><span style="color: #007700">)) </span><span style="color: #0000BB">$day</span><span style="color: #007700">--; </span><span style="color: #FF8000">// Account for days that don't exist <br></span><span style="color: #0000BB">?&gt;</span></span></pre></div> <p>Cheers. (Marking as patch even though there's no proper patch attached so that it gets noticed. Sorry.)</p>
issue