Fix date range in category service.

This commit is contained in:
Alexis Lahouze 2017-07-29 16:57:05 +02:00
parent 927459b6c5
commit 89fc42c47a

View File

@ -14,9 +14,15 @@ export class CategoryService {
) {} ) {}
query(id: number, minDate: Date = null, maxDate: Date = null): Observable<Category[]> { query(id: number, minDate: Date = null, maxDate: Date = null): Observable<Category[]> {
return this.restangular.one('account', id).getList('category', { var dateRange: any;
begin: minDate, if(minDate) {
end: maxDate dateRange.begin = minDate;
}); }
if(maxDate) {
dateRange.end = maxDate;
}
return this.restangular.one('account', id).getList('category', dateRange);
} }
} }