Fix date sort

http://manage.dimagi.com/default.asp?68805