How can I group entries based on a dateTime field? I am getting all entries from a section like this:

// get the parent entry.
{% set author = craft.entries.section('mySection').authorId(currentUser.id).first() %}

// get the child entries from the parent.
{% set entires = craft.entries({
    'section': 'mySection',
    'level': 2,
    'descendantOf': author.id
 })%}

// myDate is a dateTime filed (yyyy-mm-dd)

{% for year, entry in entries|group('myDate') %}
            &lt;h4&gt;{{ year|date('Y') }}&lt;/h4&gt;
            &lt;ul&gt;
                {% for entry in entries %}
                    {% if attempt.myDate|date('Y') == year|date('Y') %}
                        &lt;li&gt;{{ entry.myDate }} &gt; {{ entry.type.name }} - {{ entry.foo }}&lt;/li&gt;
                    {% endif %}
                {% endfor %}
            &lt;/ul&gt;
        {% endfor %}


What I have is close, however, it's outputting multiple years. For example, 

2016
  [entry]

2016
  [entry]

2015
  [entry]

 ...


I'm trying to group all of the child entries by year. For example, if I have 3 entires with the same year (2016) I am trying to show: 

2016
  [entry]
  [entry]
  [entry]

2015
  [entry]

2014
  [entry]
  [entry]

...


Thank you for any suggestions!
You're currently grouping on the myDate field, which essentially creates a new array index for each date (e.g. 2016-01-01) which is why you're getting your current output.

To group by year, this should do the trick:

{% for year, entries in entries|group('myDate.year') %}
    &lt;h4&gt;{{ year }}&lt;/h4&gt;
    &lt;ul&gt;
        {% for entry in entries %}
            ...
        {% endfor %}
    &lt;/ul&gt;
{% endfor %}