Fixed {} for isValidDate() defined function.