k-yamamuraさんの投稿で解決したかと思いますが、
暫定対応のままだと来年12月に同様の問題が発生すると思いますので、
完全対応のコードを共有致します。
(私もハマりましたので・・・)
{# CSSの初期設定読込 #}
<link rel="stylesheet" href="{{ app.config.front_urlpath }}/css/pg_calendar.css">
<div id="calendar" class="calendar hidden-xs">
<div class="calendar_title">カレンダー</div>
{% for roop in 0..(HolidayConfig['0']['config_data']-1) %}
{% set day = date('first day of this month') %}
{% set month = day|date_modify("+" ~ roop ~ " month")|date('n') %}
{% set year = day|date_modify("+" ~ roop ~ " month")|date('Y') %}
{% if (month != "1") %}
{% if month == "12" %}
{% set week = day|date_modify("+" ~ (roop+1) ~ " month")|date_modify('-1 day')|date('w') %}
{# ISO規格に基づいて #}
{% if week == 1 %}
{% set roop_week = 5 %}
{% elseif week == 2 or week == 3 %}
{% set roop_week = 4 %}
{% else %}
{% set roop_week = day|date_modify("+" ~ (roop+1) ~ " month")|date_modify('-1 day')|date('W') - day|date_modify(year ~ "-" ~ month ~ "-" ~ "01")|date('W') %}
{% endif %}
{% else %}
{% set roop_week = day|date_modify("+" ~ (roop+1) ~ " month")|date_modify('-1 day')|date('W') - day|date_modify(year ~ "-" ~ month ~ "-" ~ "01")|date('W') %}
{% endif %}
{% else %}
{% set roop_week = day|date_modify("+" ~ (roop+1) ~ " month")|date_modify('-1 day')|date('W') - 1 %}
{% endif %}
{% if ((day|date_modify("+" ~ (roop+1) ~ " month")|date_modify('-1 day')|date('w')) == "0") %}
{% set roop_week = (roop_week+1) %}
{% endif %}
{% set day = day|date_modify("+" ~ roop ~ " month")|date_modify('-' ~ day|date_modify("+" ~ roop ~ " month")|date('w') ~ 'days') %}
<table>
<caption>{{ year }}年{{ month }}月の定休日</caption>
<thead><tr><th id="sunday">日</th><th>月</th><th>火</th><th>水</th><th>木</th><th>金</th><th id="saturday">土</th></tr></thead>
<tbody>
{% for i in (0..roop_week) %}
<tr>
{% for j in (0..6) %}
{% if day|date('n') == month %}
{% if HolidayWeek[j] %}
<td class="holiday">{{ day|date('j') }}</td>
{% else %}
{% if Holidays[month][day|date('j')] is defined and Holidays[month][day|date('j')] is not empty %}
<td class="holiday">{{ day|date('j') }}</td>
{% else %}
<td>{{ day|date('j') }}</td>
{% endif %}
{% endif %}
{% else %}
<td> </td>
{% endif %}
{% set day = day|date_modify('+1day') %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endfor %}
</div>
ISO規格に沿った実装になっていなかったのが原因ですので、
それに対応できる形にしました。
以下の部分が修正箇所です。
{% if (month != "1") %}
{% if month == "12" %}
{% set week = day|date_modify("+" ~ (roop+1) ~ " month")|date_modify('-1 day')|date('w') %}
{# ISO規格に基づいて #}
{% if week == 1 %}
{% set roop_week = 5 %}
{% elseif week == 2 or week == 3 %}
{% set roop_week = 4 %}
{% else %}
{% set roop_week = day|date_modify("+" ~ (roop+1) ~ " month")|date_modify('-1 day')|date('W') - day|date_modify(year ~ "-" ~ month ~ "-" ~ "01")|date('W') %}
{% endif %}
{% else %}
{% set roop_week = day|date_modify("+" ~ (roop+1) ~ " month")|date_modify('-1 day')|date('W') - day|date_modify(year ~ "-" ~ month ~ "-" ~ "01")|date('W') %}
{% endif %}
{% else %}