From b62262d8e8ea256393fe6947ab1f4fa546f60cc3 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Mon, 6 Jun 2016 15:12:02 +0200 Subject: [PATCH] no longer show empty duration values --- .../wp-display-duration-field.module.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/wp-display/field-types/wp-display-duration-field.module.ts b/frontend/app/components/wp-display/field-types/wp-display-duration-field.module.ts index a42cc7ce6f..3995a4f67f 100644 --- a/frontend/app/components/wp-display/field-types/wp-display-duration-field.module.ts +++ b/frontend/app/components/wp-display/field-types/wp-display-duration-field.module.ts @@ -30,11 +30,25 @@ import {DisplayField} from "../wp-display-field/wp-display-field.module"; export class DurationDisplayField extends DisplayField { + private WorkPackagesHelper:any; + private TimezoneService:any; + isManualRenderer = true; + constructor(public resource:HalResource, + public name:string, + public schema) { + super(resource, name, schema); + + this.WorkPackagesHelper = this.$injector.get('WorkPackagesHelper'); + this.TimezoneService = this.$injector.get('TimezoneService'); + } + public get valueString() { - const WorkPackagesHelper:any = this.$injector.get('WorkPackagesHelper'); + return this.WorkPackagesHelper.formatValue(this.value, 'Duration'); + } - return WorkPackagesHelper.formatValue(this.value, 'Duration'); + public isEmpty():boolean { + return this.TimezoneService.toHours(this.value) === 0; } }