Answers.Body: <p>Angular example using the same options with data model binding:</p>
  
  <p></p>
  
  <p><a href="https://docs.civicrm.org/dev/en/latest/framework/ui/#date-picker" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/framework/ui/#date-picker</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-31T08:04:14.450Z
Answers.Text: Did you solve your own question? If so you could mark your answer as solved?
Answers.UserDisplayName: Jaap Jansma - CiviCooP
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-27T20:55:38.913Z
Answers.LastActivityDate: 2018-05-27T20:55:38.913Z
Answers.UserDisplayName: Mike Steigerwald
Body: <p>My angular module resolve object:</p>
  
  <pre><code>        resolve: {
        myContact: function(crmApi) {             
           return crmApi('Contact', 'getsingle', {
               //id: 'user_contact_id', 
               id: 43,
            return: ['first_name', 'last_name', 'middle_name', 'birth_date', 'gender_id']
          });
        }
      }
  </code></pre>
  
  <p>Which I am trying to bind to </p>
  
  <pre><code>            &lt;input type="date"
            crm-ui-id="tournamentForm.birth_date"
            name="birth_date"
            ng-model="myContact.birth_date"
            placeholder="yyyy-MM-dd" 
            min="1930-01-01" 
            max="2029-12-31" 
            /&gt;
  </code></pre>
  
  <p>Results in this error from angular:</p>
  
  <pre><code>Error: [ngModel:datefmt] Expected `1972-05-11` to be a date
  </code></pre>
  
  <p>Where should I (what's the best practice for) convert the string to a Date object?</p>
  
Tags: <api>
Title: Where should I convert the birth_date string to a Date object?
ThreadText: # Where should I convert the birth_date string to a Date object?
  
  (Asked by: username_0 on 2018-05-27)
  
  My angular module resolve object:
          resolve: {
        myContact: function(crmApi) {             
           return crmApi('Contact', 'getsingle', {
               //id: 'user_contact_id', 
               id: 43,
            return: ['first_name', 'last_name', 'middle_name', 'birth_date', 'gender_id']
          });
        }
      }
  
  Which I am trying to bind to 
              
  
  Results in this error from angular:
  Error: [ngModel:datefmt] Expected `1972-05-11` to be a date
  
  Where should I (what's the best practice for) convert the string to a Date object?
  
  **Tags:** api
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-05-27. Score: 3 | Accepted answer
  
  Angular example using the same options with data model binding:
  
  <https://docs.civicrm.org/dev/en/latest/framework/ui/#date-picker>
  
  > **Comments:**
  > **username_1**: Did you solve your own question? If so you could mark your answer as solved?  
  
  ---
  
  