more defensive date handling