mirror of
https://github.com/valitydev/fraudbusters-ui.git
synced 2024-11-06 16:45:19 +00:00
Fix date
This commit is contained in:
parent
e2a1bea3be
commit
689498600b
@ -9,7 +9,7 @@
|
||||
[ngxMatDatetimePicker]="pickerFrom"
|
||||
formControlName="from"
|
||||
/>
|
||||
<mat-datepicker-toggle matSuffix [for]="pickerFrom" dataformatas=""></mat-datepicker-toggle>
|
||||
<mat-datepicker-toggle matSuffix [for]="pickerFrom"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker showSeconds="true" #pickerFrom></ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
<mat-form-field floatLabel="always" appearance="fill" class="date-picker">
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Output } from '@angular/core';
|
||||
import { AfterViewChecked, Component, EventEmitter, Output } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { debounceTime, map, take } from 'rxjs/operators';
|
||||
@ -34,7 +34,10 @@ export class HistoryDataSearchComponent {
|
||||
private searchFieldService: SearchFieldService
|
||||
) {
|
||||
this.form.valueChanges.pipe(debounceTime(600), map(removeEmptyProperties)).subscribe((v) => {
|
||||
this.router.navigate([location.pathname], { queryParams: v });
|
||||
const params = Object.create(v);
|
||||
params.from = new Date(v.from).toISOString();
|
||||
params.to = new Date(v.to).toISOString();
|
||||
this.router.navigate([location.pathname], { queryParams: params });
|
||||
this.valueChanges.emit(v);
|
||||
});
|
||||
this.route.queryParams.pipe(take(1)).subscribe((v) => this.form.patchValue(v));
|
||||
|
@ -10,6 +10,7 @@ export class SearchFieldService {
|
||||
|
||||
todayFromTime(): Date {
|
||||
const now = new Date();
|
||||
now.setDate(now.getDate() - 1);
|
||||
now.setHours(0, 0, 0, 0);
|
||||
return now;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user