Closed 0cv closed 7 years ago
@Krisa Thanks for this changes.
(change)
was used to detect the value when user manually change the value. Without ngModel
and ngModelChange
, I think the value
manually changed will not open a proper date. However, let's see how it goes.
Currently we don't have a solid tests, and I am building a test framework for all our UI web browser tests.
I see. But on another hand, we only have ngModel and formControl. And both are working fine (or seem to) without the change
listener. But maybe it's because there was before a custom way to subscribe to changes?
Anyway test framework will definitely be useful.
yes user can selectngModel
or formControl
to detect changes for now. I think it's good enough.
I get the code with changes but it doesn't work. I do changes and work to me. The changes following: In ngOnChanges method i iserted: if (this.dateFormat.length == (newNgModel != null ? newNgModel.length : -1)) { this.hideDatetimePicker(); this.showDatetimePicker(); }
In valueChanged method I comment: //else if (typeof date === 'undefined') { // this.el['dateValue'] = null; // }
I don't know if this changes break anything. I tested and work.
Anybody can help me?
@odisi can you create a plunkr (and open a separated issue unless this is related to this PR)?
Also, please note that following code is all what you need to get to work the datepicker:
<form [formGroup]="myForm">
<input formControlName="date" ng2-datetime-picker close-on-select="false"/>
</form>
If the user type a date like 2010-08-01, the calendar don't select the typed date.
if you try the plunkr https://plnkr.co/edit/su2aiL?p=preview, it does.
I tested and don't work. My test was: Type a date like 1984-01-08 and the calendar select and show the typed date.
Working well in Chrome...
Of course you need to close the datepicker and reopen it, i.e. there is not a "real-time" binding
Yes, It's this that I'm talking about. To work in "real-time" like a jquery ui or others. I do a change that close and open the calendar to work like "real-time".
Makes sense. Let's track that somewhere else
This shall resolve https://github.com/ng2-ui/ng2-datetime-picker/issues/44 Additionally add the Tab and Enter key code to close the Datepicker
@allenhwkim I have a doubt what the change listener was used for. By removing it, it resolves the mentioned issue but I couldn't identify any side effect. Have you any idea, or concern?