I've been struggling with this in a bit and could not get a satisfactory result. I have this hash:
{"idprj"=>13351, "prevInicioStr"=>"21/10/2019"}
{"idprj"=>14473, "prevInicioStr"=>"22/10/2019"}
{"idprj"=>14165, "prevInicioStr"=>"23/10/2019"}
{"idprj"=>14165, "prevInicioStr"=>"23/10/2019"}
{"idprj"=>14165, "prevInicioStr"=>"28/10/2019"}
{"idprj"=>14165, "prevInicioStr"=>"28/10/2019"}
{"idprj"=>14518, "prevInicioStr"=>"29/10/2019"}
{"idprj"=>14518, "prevInicioStr"=>"29/10/2019"}
{"idprj"=>13351, "prevInicioStr"=>"05/11/2019"}
{"idprj"=>14305, "prevInicioStr"=>"06/11/2019"}
{"idprj"=>14305, "prevInicioStr"=>"08/11/2019"}
{"idprj"=>14305, "prevInicioStr"=>"13/01/2020"}
And I wanted to sort by 'prevInicioStr' AND group by 'idprj' (you can see id 13351 isn't grouped as it should). To get this result I did this:
result.sort_by { |hash| [ Date.parse(hash['prevInicioStr']), hash['idprj'] ] }