Closed kibbled closed 7 years ago
Thanks and No, it does not require use of reactive forms.
AFAIK, this is not possible from this line, unless you are using invalid momentjs;
https://github.com/ng2-ui/ng2-datetime-picker/blob/master/src/ng2-datetime.ts#L19
Please create a plunker example, so that I can reproduce your issue.
Attached is what the DateTime Picker looks like:
Going through the call stack, this.el['dateValue’] is Ng2DatetimePickerDirective line 223.
If I comment out instantiation to Date() like below then it works and holds the value correctly in the model.
public deleteMe: Date;// = new Date();
Basically it doesn’t like it when I default the value of the model I’m binding to it.
Nope, still not getting it. Are you using IE8 or something? I assume the following does not work for your environment.
var d = new Date();
d.getFullYear(); // NaN instead of 2017
Getting the standard error: EXCEPTION: Cannot read property 'fullName' of undefined
When I click into the date time picker.
<input id="myDateTime" name="myDateTime" [(ngModel)]="deleteMe" ng2-datetime-picker />
Thanks