Fixed error 500 when date format is wrong