Fix crashes when localtime() can't handle the date.