Fixed date sorting bug