My goal is to ensure that the time and date entered in my form are not in the past.
Currently, I have separate input boxes for the time and date, each validated using ng-pattern. How can I display an error (ng-invalid) when both input boxes combined result in a date from the past?
While I can perform the past vs. future calculation using moment.js, I am unsure how to handle the combination of these two input boxes. Can a directive only work on a single element, not two?
<input type="text" ng-model="startTime" ng-pattern="/^(?:\d|[01]\d|2[0-3]):[0-5]\d$/">
<input type="text" ng-model="startDate" ng-pattern="/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/">