ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

Reimplement some blocks #20

Closed visitek closed 7 years ago

visitek commented 7 years ago

Fixes #19 DatetimePicker is interactive now. Model value is separated from emitted value.

visitek commented 7 years ago
<input datetime-picker
              [value]="value"
              (valueChange)="onValueChange($event)"
              close-on-select="false"
              date-format="DD.MM.YYYY HH:mm"
      >

Tested and works fine with setting value and opened picker reacts immediately to external changes of input value.

allenhwkim commented 7 years ago

Is there a reason to change ngModel to value. It's confusing for me. e.g. "value"="value", [value]="value"

visitek commented 7 years ago

Yes, because ngModel is encapsulated and must be implemented both with ngModelChange. In this case the visible value of input is formatted, but real value is kept in Date. It can not be used with ngModel.

visitek commented 7 years ago

We can not emit formatted value as ngModelChange event, because it is not true. Event with Date is true output

allenhwkim commented 7 years ago

cool, one more request. could you change 8 space hard-tab to 2 space soft-tab? It makes my life a lot easier for consistency.

visitek commented 7 years ago
<input datetime-picker
              [value]="fromTimeISO"
              (valueChange)="onFromChange($event)"
              close-on-select="false"
              date-format="DD.MM.YYYY HH:mm"
      >

better? :)

visitek commented 7 years ago

yes..

allenhwkim commented 7 years ago

The reason I am asking is that using "[value]" is a breaking change. With this release, all the existing users must change their code. Thus, it must be notified to user as "BRAEKING CHANGES" for release. Can we make it [(ngModel)] deprecated if possible?

visitek commented 7 years ago

I'll try it

visitek commented 7 years ago

I've added non breaking changes. But it is really deprecated. ngModel can be used without reactive changes

visitek commented 7 years ago

create releases and handle breaking changes

TheCodonist commented 7 years ago

is there any plnkr example??