Changed if (rawValue != null) to (rawValue) - so that empty strings will not satisfy that condition - this fixes invalid date error when input value is blank