Ugly algo for searching date