Date conversion returning December for every single digit month representation
Here's what's happening... Every time you get "December", it's because the date is being parsed as December 31, 1969 (aka, just before the Unix Epoch). Basically, it's failing to parse the date properly, and thus defaulting back to the Epoch.

And here's why... date(key) is basically saying "Get the date of 4". Which obviously doesn't make any sense. So the "date of 4" is a fail, and you get the Epoch default instead.

So here's what I recommend instead... replace this:

{% set monthName = date(key) | date('F') %}


... with something more like this:

{% switch key %}
    {% case 1 %}
        {% set monthName = 'January'|t %}
    {% case 2 %}
        {% set monthName = 'February'|t %}
    {% case 3 %}
        {% set monthName = 'March'|t %}
    {% case 4 %}
        {% set monthName = 'April'|t %}
    {% case 5 %}
        {% set monthName = 'May'|t %}
    {% case 6 %}
        {% set monthName = 'June'|t %}
    {% case 7 %}
        {% set monthName = 'July'|t %}
    {% case 8 %}
        {% set monthName = 'August'|t %}
    {% case 9 %}
        {% set monthName = 'September'|t %}
    {% case 10 %}
        {% set monthName = 'October'|t %}
    {% case 11 %}
        {% set monthName = 'November'|t %}
    {% case 12 %}
        {% set monthName = 'December'|t %}
{% endswitch %}


That's a big chunk of code, I know. So feel free to offload that to a macro if it's more convenient.

Alternately, you could use a placeholder date, as carlcs suggested in his answer.