Quoting the date field when passing to query when days time is calculated.

We are doing this when the date argument is not null.