Skip to content
This repository has been archived by the owner on Mar 2, 2018. It is now read-only.

Commit

Permalink
issue #155, set proper date if the input has invalid date
Browse files Browse the repository at this point in the history
  • Loading branch information
allenhwkim committed Mar 4, 2017
1 parent cec2f6f commit 54173ec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ng2-datetime-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ export class Ng2DatetimePickerComponent {


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

This comment has been minimized.

Copy link
@NadeauJessy

NadeauJessy Mar 6, 2017

defaultValue is no more optional.
Got error: Cannot read property 'getTime' of null
after updating to 0.14.4

This comment has been minimized.

Copy link
@allenhwkim

allenhwkim Mar 7, 2017

Author Contributor

This has been fixed

this.defaultValue = new Date();
}
this.selectedDate = this.defaultValue || new Date();

// set hour and minute using moment if available to avoid having Javascript change timezones
Expand Down

0 comments on commit 54173ec

Please sign in to comment.