From 602ec635c2f0388e4dd9538cea42753cb577700b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Mon, 10 Oct 2016 12:18:52 +0100 Subject: [PATCH] #632 fix display value widget for dates --- .../widgets/display-value/display-value.widget.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ng2-components/ng2-activiti-form/src/components/widgets/display-value/display-value.widget.ts b/ng2-components/ng2-activiti-form/src/components/widgets/display-value/display-value.widget.ts index 5ea68a5901..64db3f7f07 100644 --- a/ng2-components/ng2-activiti-form/src/components/widgets/display-value/display-value.widget.ts +++ b/ng2-components/ng2-activiti-form/src/components/widgets/display-value/display-value.widget.ts @@ -22,6 +22,7 @@ import { FormService } from '../../../services/form.service'; import { FormFieldOption } from './../core/form-field-option'; declare var componentHandler; +declare var moment: any; @Component({ moduleId: module.id, @@ -84,6 +85,14 @@ export class DisplayValueWidget extends WidgetComponent implements OnInit { this.loadRadioButtonValue(); } break; + case FormFieldTypes.DATE: + if (this.value) { + let d = moment(this.value.split('T')[0]); + if (d.isValid()) { + this.value = d.format('D-M-YYYY'); + } + } + break; default: this.value = this.field.value; break;