853229 - blank sync plan date gives incorrect error #647
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously we relied on convert_date_time to throw an exception to catch. If an exception occurred we would leave date blank and let the model validation throw a validation error.
With this commit: 18d2fbe that was removed, so the exception convert_date_time threw simply went to the browser as a notification. This would also mean that invalid formats would show up with a warning that they couldn't be 'blank'.
So this commit has 2 parts, simply have convert_date_time return nil if either date or time is blank, so the model validation will get caught. If the conversion to a date object throws an exception however, we want to catch it and throw a more human readable exception. Ideally this would occur within the model and be a validaiton error, but that doesn't seem to be easy to do, since the model doesn't even have a time field, and the date field is something different completely.