Answers.Body: <p>I think the problem is that you are not being specific enough with the date that you are passing to the date function. You are in effect calling date("February") and the PHP date function has to make an assumption and uses the current day of the month, i.e. February 30 which equates to March. If this is correct you will have even more issues tomorrow being the 31st!</p>
  
  <p>If you make the date being passed more specific i.e. February 1 it should work fine.</p>
  
  <p>A related PHP bug post, that wasn't a bug, explains it <a href="https://bugs.php.net/bug.php?id=49115" rel="nofollow noreferrer">https://bugs.php.net/bug.php?id=49115</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-12T20:55:57.863Z
Answers.Text: This is the correct answer, and echoes what is stated here: https://bugs.php.net/bug.php?id=49115 -- not a bug.
Answers.UserDisplayName: andrew.welch
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-30T23:17:56.413Z
Answers.LastActivityDate: 2018-12-30T23:17:56.413Z
Answers.UserDisplayName: JollyR
Answers.Body: <p>As @jollyR said in their response there is a bug with php dates. I resolved this issue by changing the relevant code to below.</p>
  
  <pre><code>&lt;li&gt;
    {# need month to include year to avoide a bug with short months when the current day is 30 or 31 i.e. february #}
    {% set thisMonth = month ~ '-' ~ year %}
  
    &lt;a href="/calendar/{{ year }}/{{ thisMonth|date('m') }}"&gt;{{ month }}&amp;nbsp;({{ entries|length }})&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-31T14:10:08.987Z
Answers.LastActivityDate: 2018-12-31T14:10:08.987Z
Answers.UserDisplayName: CreateSean
Body: <p>This is a site that was recently updated from Craft 2 to Craft 3 and before the update this issue did not occur.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>{# all entries sorted by year/month #}
   {% set allEntries = craft.entries.section('photoblog').limit(null).orderBy('postDate desc').all() %}
  
    &lt;div class="years"&gt;
      {% for year, entriesInYear in allEntries | group("postDate|date('Y')") %}
          &lt;div class="col-sm-3 col-xs-4" data-mh="years"&gt;
            &lt;h3&gt;{{ year }}&lt;/h3&gt;
            &lt;ul class="list-unstyled"&gt;
            {% for month, entries in entriesInYear | group("postDate|date('F')" ) |  reverse %}
                &lt;li&gt;&lt;a href="/calendar/{{ year }}/{{ month|date('m') }}"&gt;{{ month }}&amp;nbsp;({{ entries|length }})&lt;/a&gt;&lt;/li&gt;
            {% endfor %}
            &lt;/ul&gt;
          &lt;/div&gt;
      {% endfor %}
    &lt;/div&gt;
  </code></pre>
  
  <p>Everything works correctly except for February which always outputs <code>03</code> and not <code>02</code> as expected.</p>
  
  <p>If you go to <a href="https://sean-smith.net/calendar" rel="nofollow noreferrer">https://sean-smith.net/calendar</a> and hover over any <strong>February</strong> link you'll see that the link is set to March inexplicably.</p>
  
Tags: <templating><postdate>
Title: February always comes out as March - expect /yyyy/mm to be 2018/02 but it's 2018/03
ThreadText: # February always comes out as March - expect /yyyy/mm to be 2018/02 but it's 2018/03
  
  (Asked by: username_0 on 2018-12-30)
  
  This is a site that was recently updated from Craft 2 to Craft 3 and before the update this issue did not occur.
  
  Here is the code:
  
  ```
  {# all entries sorted by year/month #}
   {% set allEntries = craft.entries.section('photoblog').limit(null).orderBy('postDate desc').all() %}
  
    <div class="years">
      {% for year, entriesInYear in allEntries | group("postDate|date('Y')") %}
          <div class="col-sm-3 col-xs-4" data-mh="years">
            <h3>{{ year }}</h3>
            <ul class="list-unstyled">
            {% for month, entries in entriesInYear | group("postDate|date('F')" ) |  reverse %}
                <li><a href="/calendar/{{ year }}/{{ month|date('m') }}">{{ month }}&nbsp;({{ entries|length }})</a></li>
            {% endfor %}
            </ul>
          </div>
      {% endfor %}
    </div>
  
  ```
  
  Everything works correctly except for February which always outputs `03` and not `02` as expected.
  
  If you go to <https://sean-smith.net/calendar> and hover over any **February** link you'll see that the link is set to March inexplicably.
  
  **Tags:** templating, postdate
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-12-31. Score: 0 | Accepted answer
  
  As @jollyR said in their response there is a bug with php dates. I resolved this issue by changing the relevant code to below.
  
  ```
  <li>
    {# need month to include year to avoide a bug with short months when the current day is 30 or 31 i.e. february #}
    {% set thisMonth = month ~ '-' ~ year %}
  
    <a href="/calendar/{{ year }}/{{ thisMonth|date('m') }}">{{ month }}&nbsp;({{ entries|length }})</a>
  </li>
  
  ```
  
  
  ---
  
  ### Answer by username_1 on 2018-12-30. Score: 4
  
  I think the problem is that you are not being specific enough with the date that you are passing to the date function. You are in effect calling date("February") and the PHP date function has to make an assumption and uses the current day of the month, i.e. February 30 which equates to March. If this is correct you will have even more issues tomorrow being the 31st!
  
  If you make the date being passed more specific i.e. February 1 it should work fine.
  
  A related PHP bug post, that wasn't a bug, explains it <https://bugs.php.net/bug.php?id=49115>
  
  > **Comments:**
  > **username_2**: This is the correct answer, and echoes what is stated here: https://bugs.php.net/bug.php?id=49115 -- not a bug.  
  
  ---
  
  