diff --git a/src/datepicker/bs-datepicker-input.directive.ts b/src/datepicker/bs-datepicker-input.directive.ts index 399fef439c..a39e28a868 100644 --- a/src/datepicker/bs-datepicker-input.directive.ts +++ b/src/datepicker/bs-datepicker-input.directive.ts @@ -93,7 +93,7 @@ export class BsDatepickerInputDirective onChange(event: Event) { /* tslint:disable-next-line: no-any*/ - this.writeValue((event.target as any).value, this._picker._config.useUtc); + this.writeValue((event.target as any).value); this._onChange(this._value); this._onTouched(); } @@ -126,7 +126,7 @@ export class BsDatepickerInputDirective this._validatorChange = fn; } - writeValue(value: Date | string, isUtc = true) { + writeValue(value: Date | string) { if (!value) { this._value = null; } else { @@ -140,7 +140,7 @@ export class BsDatepickerInputDirective this._value = parseDate(value, this._picker._config.dateInputFormat, this._localeService.currentLocale); - if (isUtc) { + if (this._picker._config.useUtc) { this._value = utcAsLocal(this._value); } } diff --git a/src/datepicker/bs-daterangepicker-input.directive.ts b/src/datepicker/bs-daterangepicker-input.directive.ts index 2f94aaf604..2b4338b56c 100644 --- a/src/datepicker/bs-daterangepicker-input.directive.ts +++ b/src/datepicker/bs-daterangepicker-input.directive.ts @@ -106,7 +106,7 @@ export class BsDaterangepickerInputDirective onChange(event: Event) { /* tslint:disable-next-line: no-any*/ - this.writeValue((event.target as any).value, this._picker._config.useUtc); + this.writeValue((event.target as any).value); this._onChange(this._value); this._onTouched(); } @@ -142,7 +142,7 @@ export class BsDaterangepickerInputDirective this._validatorChange = fn; } - writeValue(value: Date[] | string, isUtc = true) { + writeValue(value: Date[] | string) { if (!value) { this._value = null; } else { @@ -166,7 +166,7 @@ export class BsDaterangepickerInputDirective this._value = (_input as string[]) .map((_val: string): Date => { - if (isUtc) { + if (this._picker._config.useUtc) { return utcAsLocal( parseDate(_val, this._picker._config.dateInputFormat, this._localeService.currentLocale) );