fix months

This commit is contained in:
2024-07-31 13:54:23 +02:00
parent 3d72531a48
commit 90fab36231
2 changed files with 18 additions and 2 deletions
+1 -2
View File
@@ -6,14 +6,13 @@ class MonthHelper
public function takeMonths() : array public function takeMonths() : array
{ {
$startDate = new \DateTime("-6 months"); $startDate = new \DateTime("-6 months");
$startDate->modify("first day of this month");
$return = []; $return = [];
for ($i=1; $i<=11; $i++) { for ($i=1; $i<=11; $i++) {
$tmp = clone $startDate; $tmp = clone $startDate;
$tmp->modify("+$i month"); $tmp->modify("+$i month");
$return[$i] = $tmp; $return[$i] = $tmp;
} }
return $return; return $return;
} }
@@ -19,5 +19,22 @@
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
{# <ul class="nav nav-tabs">#}
{# <li class="nav-item">#}
{# <a class="nav-link {% if currentMonth is null %}active{% endif %}" aria-current="page" href="{{ path(routeName, {monthId:-1}) }}">Zaległe</a>#}
{# </li>#}
{# {% for id,month in months %}#}
{# {% set isCurrent = currentMonth is not null and month | date("Y-m") == currentMonth | date("Y-m") %}#}
{# <li class="nav-item">#}
{# <a class="nav-link {% if isCurrent %}active{% endif %}" href="{{ path(routeName,{monthId: id}) }}" aria-current="page">#}
{# {% if routeName=='app_schedule' %}#}
{# {{ id }}#}
{# {% else %}#}
{# {{ month | date("Y-m") }}#}
{# {% endif %}#}
{# </a>#}
{# </li>#}
{# {% endfor %}#}
{# </ul>#}
</div> </div>
{% endmacro %} {% endmacro %}