I have a lightgning component for Account Creation / update. In this component i use as input field a date field. I want somehow to validate in Apex (Component Controller) that the date the user has input is valid. For example, now what happens is if user inserts on this field the value "asdasdsadas", the record is saved with null date. I want before it gets saved to call an apex function to check that in this field the format is 'yyyy-mm-dd'. Any suggestions ?
lightning:inputField already validates the date entry, why do you need to do it in Apex? See documentation.
Date: Displays an input field for entering a date. The date format is automatically validated against the user’s Salesforce locale format