ng2-ui / datetime-picker

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

Empty default value gives error #159

Closed negberts closed 7 years ago

negberts commented 7 years ago

There is a bug with defaultvalue on the latest package The added line:

if(isNaN(this.defaultValue.getTime())) {

      this.defaultValue = new Date();

    }

fails when no default value is selected because this.defaultValue is null. So check should be

if(!this.defaultValue || isNaN(this.defaultValue.getTime())) {

      this.defaultValue = new Date();

    }
allenhwkim commented 7 years ago

@negberts thanks. This will be fixed soon

negberts commented 7 years ago

Works again