Fixed error handling for date conversions