sort correlated dates to check from and to are in correct range