More sane query date handling