Fixed #2983 Corrected date range queries