IckleChris/ic-datepicker

Support current-date initialization

AnthonyYY opened this issue · 2 comments

It would be perfect to provide an easy way to initialize current date

Apologies for the delayed response;

To me it doesn't make much sense to provide a model binding and an initial date as separate values. When you use the component you will be binding it to a model in the component, so to set its state you would just do so there.

So for example if you are using model driven forms;

Template

<form [formGroup]="myForm">
  <ic-datepicker formControlName="myDate"></ic-datepicker>
</form>

Component

let myInitialDate = '2017-01-01';

this.myForm = new FormGroup({
  myDate: new FormControl(myInitialDate)
});

And if you are using template driven forms, just set the corresponding model property in the component to the desired date.

Or am I misunderstanding your issue?

Closing due to inactivity - ping me another comment if this is still an issue.