title: ExtJS Model Validations: Dates (How to)
body: <p>What's the best way to go about adding validation to a date field in a model</p>
  
  <pre>Ext.define('User', {
      extend: 'Ext.data.Model',
      fields: [
          {name: 'name',     type: 'string'},
          {name: 'age',      type: 'int'},
          {name: 'phone',    type: 'string'},
          {name: 'gender',   type: 'string'},
          {name: 'username', type: 'string'},
          {name: 'alive',    type: 'boolean', defaultValue: true}
      ],
  
      validations: [
          {type: 'presence',  field: 'age'},
          {type: 'length',    field: 'name',     min: 2},
          {type: 'inclusion', field: 'gender',   list: ['Male', 'Female']},
          {type: 'exclusion', field: 'username', list: ['Admin', 'Operator']},
          {type: 'format',    field: 'username', matcher: /([a-z]+)[0-9]{2,3}/}
      ]
  });</pre>
  
  <p>Let's say the above code contained a 'dob' field for date of birth. How would I go about adding a validation for it?</p>
  
  <p>My assumption is that I would use :</p>
  
  <pre>{type: 'format', field: 'dob', matcher: /([a-z]+)[0-9]{2,3}/}</pre>
  
  <p>but would use a regex that's designed to validate a date. Is there a better way to do this? I noticed that date fields on forms use their own validation methods to highlight a date field. Is there something like that for date fields in models?</p>