only apply datespan filter if valid

http://manage.dimagi.com/default.asp?102964
Merge pull request #2879 from dimagi/timezone-500

only apply datespan filter if valid