fixed date range syntax to work with mysql or Postgres