0

I have an input with type text, that I'm using to set dates:

<input ng-model="model.JoinDate" 
       ui-mask="{{'99/99/9999'}}" 
       type="text" required
       ng-class="{error: form.JoinDate.$dirty && form.JoinDate.$invalid}"  />

The problem is that the user can type something like 00/00/0000. How can I validate the date, without creating a new directive?

Matheus Lima
  • 2,103
  • 3
  • 31
  • 49
  • 1
    Maybe this will help: http://stackoverflow.com/questions/14146655/angularjs-how-to-validate-date-in-us-format – drew_w Feb 19 '14 at 13:41

2 Answers2

0

What about using angular ui bootstrap datepicker?

http://angular-ui.github.io/bootstrap/#/datepicker

Braulio
  • 1,748
  • 14
  • 23
0
<span style="color:red" ng-show="subform6{{$index}}.$dirty && subform6{{$index}}.date.$invalid && subform6{{$index}}.date.$error"> 
<br> <small ng-show="subform6{{$index}}.fd_judgement_date.$error.pattern">Incorrect Format, should be DD/MM/YYYY</small> 
</span> 
</ng-form>
Aleksandr M
  • 24,264
  • 12
  • 69
  • 143
Tejal
  • 1
  • 1