Skip to content

Commit

Permalink
feat(timepicker): allow null value and change validation state on man…
Browse files Browse the repository at this point in the history
…ual update (#3084)
  • Loading branch information
valorkin authored Nov 21, 2017
1 parent 7616362 commit 0d72cd6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/timepicker/timepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
parseTime,
isInputValid
} from './timepicker.utils';
import { fakeAsync } from '@angular/core/testing';

export const TIMEPICKER_CONTROL_VALUE_ACCESSOR: any = {
provide: NG_VALUE_ACCESSOR,
Expand Down Expand Up @@ -205,6 +206,7 @@ export class TimepickerComponent
_updateTime() {
const _seconds = this.showSeconds ? this.seconds : void 0;
if (!isInputValid(this.hours, this.minutes, _seconds, this.isPM())) {
this.isValid.emit(false);
this.onChange(null);

return;
Expand Down Expand Up @@ -239,6 +241,8 @@ export class TimepickerComponent
writeValue(obj: any): void {
if (isValidDate(obj)) {
this._store.dispatch(this._timepickerActions.writeValue(parseTime(obj)));
} else if (obj == null) {
this._store.dispatch(this._timepickerActions.writeValue(null));

This comment has been minimized.

Copy link
@sonukapoor

sonukapoor Nov 22, 2017

Contributor

shouldn't this be === ?

}
}

Expand Down

0 comments on commit 0d72cd6

Please sign in to comment.