title: Group array by year
body: <p>I am hitting a REST API which provides me a set of data contained in an array. The dates are strings. </p>
  
  <p>The following is what the data looks like:</p>
  
  <pre><code>arr = [
      "2015-07-31",
      "2015-08-31",
      "2015-09-30",
      "2015-10-31",
      "2015-11-30",
      "2015-12-31",
      "2016-01-31",
      "2016-02-29",
      "2016-03-31",
      "2016-04-30",
      "2016-05-31",
      "2016-06-30",
      // MORE ITEMS...
  ]
  </code></pre>
  
  <p>How would  I achieve grouping this array by year (e.g. 2015: July, August, September etc. 2016: January, February, March etc.).</p>
  
  <p>Would a custom pipe helps? And is it better to do the grouping in the controller rather than the service?</p>