2

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

            <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" 
          />

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?

3

Angular example using the same options with data model binding:

https://docs.civicrm.org/dev/en/latest/framework/ui/#date-picker

  • Did you solve your own question? If so you could mark your answer as solved? – Jaap Jansma - CiviCooP May 31 '18 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.