Fixed filtering with dates

Everything is horrible, need to optimize