Skip to content

Commit

Permalink
fix(datepicker): fix utc option issue (#5534)
Browse files Browse the repository at this point in the history
  • Loading branch information
Domainv authored Oct 28, 2019
1 parent 9df0788 commit 04e6aad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/datepicker/bs-datepicker-input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/datepicker/bs-daterangepicker-input.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
);
Expand Down

0 comments on commit 04e6aad

Please sign in to comment.