From 89fc42c47ad1f82f4f9a7be6aef4b73e965f3ed2 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sat, 29 Jul 2017 16:57:05 +0200 Subject: [PATCH] Fix date range in category service. --- src/operations/category.service.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/operations/category.service.ts b/src/operations/category.service.ts index 675ff2d..44f33c5 100644 --- a/src/operations/category.service.ts +++ b/src/operations/category.service.ts @@ -14,9 +14,15 @@ export class CategoryService { ) {} query(id: number, minDate: Date = null, maxDate: Date = null): Observable { - return this.restangular.one('account', id).getList('category', { - begin: minDate, - end: maxDate - }); + var dateRange: any; + if(minDate) { + dateRange.begin = minDate; + } + + if(maxDate) { + dateRange.end = maxDate; + } + + return this.restangular.one('account', id).getList('category', dateRange); } }