title: Filter an array of objects with same period values based on second last grater timestamp (date)?
body: <p>I want to filter an array, object that contains the second last date for the same period.
  For example, for the <code>&quot;period&quot;: 2</code>. <code>&quot;timestamp&quot;: &quot;3/11/2016 02:15:11&quot;</code> would be the second last date.</p>
  <p>Input Array:</p>
  <pre><code>[ 
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 02:13:11&quot;, &quot;amount&quot;: 7.25, &quot;period&quot;: 2 },
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 02:15:11&quot;, &quot;amount&quot;: 7.25, &quot;period&quot;: 2 },
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 06:50:57&quot;, &quot;amount&quot;: 11.75, &quot;period&quot;: 6 },
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 06:52:45&quot;, &quot;amount&quot;: 11.75, &quot;period&quot;: 6 }
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 06:59:59&quot;, &quot;amount&quot;: 11.75, &quot;period&quot;: 6 },
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 07:02:54&quot;, &quot;amount&quot;: 4.5, &quot;period&quot;: 7 }
  ]
  </code></pre>
  <p>Expected Output Array:</p>
  <pre><code>[ 
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 02:13:11&quot;, &quot;amount&quot;: 7.25, &quot;period&quot;: 2 },  
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 06:52:45&quot;, &quot;amount&quot;: 11.75, &quot;period&quot;: 6 },
    { &quot;ip&quot;: &quot;11.11.11.11&quot;, &quot;timestamp&quot;: &quot;3/11/2016 07:02:54&quot;, &quot;amount&quot;: 4.5, &quot;period&quot;: 7 }
  ]
  </code></pre>