Fixed SQLAlchemy filtering for history view, to deal with dates instead of datetimes.