Sort Array Based On Date Javascript Code