Bug fix when the date is invalid
Handle empty values for the Apply statement