Skip to content

Commit

Permalink
fix(module:datepicker): enable simplified boolean usage (NG-ZORRO#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
trotyl authored and schsiung committed Dec 18, 2017
1 parent a502bbc commit 4b63715
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/datepicker/nz-datepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ import { toBoolean } from '../util/convert';
export class NzDatePickerComponent implements ControlValueAccessor, OnInit {
private _allowClear = true;
private _disabled = false;
private _showTime: Partial<NzTimePickerInnerComponent> = null;
_el: HTMLElement;
_open = false;
_mode = 'year';
Expand All @@ -210,14 +211,26 @@ export class NzDatePickerComponent implements ControlValueAccessor, OnInit {
// ngModel Access
onChange: (value: Date) => void = () => null;
onTouched: () => void = () => null;
@Input() nzShowTime = null;
@Input() nzPlaceHolder = this._locale.translate('DateTime.chooseDatePlease');
@Input() nzFormat = 'YYYY-MM-DD';
@Input() nzSize = '';
@Input() nzMode: 'day' | 'month' = 'day';
@ViewChild('trigger') trigger;
@ViewChild(NzTimePickerInnerComponent) timePickerInner: NzTimePickerInnerComponent;

@Input()
set nzShowTime(value: Partial<NzTimePickerInnerComponent>) {
if (typeof value === 'string' || typeof value === 'boolean') {
this._showTime = toBoolean(value) ? {} : null;
} else {
this._showTime = value;
}
}

get nzShowTime(): Partial<NzTimePickerInnerComponent> {
return this._showTime;
}

@Input()
set nzAllowClear(value: boolean) {
this._allowClear = toBoolean(value);
Expand Down

0 comments on commit 4b63715

Please sign in to comment.