From 2ed61d55529d518bcdf618a72a49fd17f9f8ee37 Mon Sep 17 00:00:00 2001 From: Karamath Date: Thu, 16 Aug 2018 21:15:39 +0100 Subject: [PATCH 1/2] RDM-2468: Date field error correction --- .../form/date-input/date-input.component.ts | 19 +++++++++++++++++-- .../form/date-input/date-input.html | 18 ++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/components/form/date-input/date-input.component.ts b/src/components/form/date-input/date-input.component.ts index 54892d23d1..cfa82ee851 100644 --- a/src/components/form/date-input/date-input.component.ts +++ b/src/components/form/date-input/date-input.component.ts @@ -31,6 +31,7 @@ export class DateInputComponent implements ControlValueAccessor, Validator, OnIn @Input() public formControl: FormControl; + public isTouched: boolean = false; public displayDay: string = null; public displayMonth: string = null; public displayYear: string = null; @@ -173,9 +174,23 @@ export class DateInputComponent implements ControlValueAccessor, Validator, OnIn this.propagateChange(this.rawValue); } + public inputFocus() { + this.isTouched = false; + this.touch(); + } + public inputBlur() { - this.formControl.markAsTouched(); - this.propagateChange(this.rawValue); + this.isTouched = true; + this.touch(); + } + + public touch() { + if (this.isTouched) { + this.formControl.markAsTouched(); + this.propagateChange(this.rawValue); + } else { + this.formControl.markAsUntouched(); + } } public dayId() { diff --git a/src/components/form/date-input/date-input.html b/src/components/form/date-input/date-input.html index 43684d093d..896edcb8e2 100644 --- a/src/components/form/date-input/date-input.html +++ b/src/components/form/date-input/date-input.html @@ -10,7 +10,8 @@ [value]="displayDay" (change)="dayChange(dayInput.value)" (keyup)="dayChange(dayInput.value)" - (blur)="inputBlur()"> + (blur)="inputBlur()" + (focus)="inputFocus()">
@@ -23,7 +24,8 @@ [value]="displayMonth" (change)="monthChange(monthInput.value)" (keyup)="monthChange(monthInput.value)" - (blur)="inputBlur()"> + (blur)="inputBlur()" + (focus)="inputFocus()">
@@ -36,7 +38,8 @@ [value]="displayYear" (change)="yearChange(yearInput.value)" (keyup)="yearChange(yearInput.value)" - (blur)="inputBlur()"> + (blur)="inputBlur()" + (focus)="inputFocus()">
@@ -49,7 +52,8 @@ [value]="displayHour" (change)="hourChange(hourInput.value)" (keyup)="hourChange(hourInput.value)" - (blur)="inputBlur()"> + (blur)="inputBlur()" + (focus)="inputFocus()">
@@ -62,7 +66,8 @@ [value]="displayMinute" (change)="minuteChange(minuteInput.value)" (keyup)="minuteChange(minuteInput.value)" - (blur)="inputBlur()"> + (blur)="inputBlur()" + (focus)="inputFocus()">
@@ -75,7 +80,8 @@ [value]="displaySecond" (change)="secondChange(secondInput.value)" (keyup)="secondChange(secondInput.value)" - (blur)="inputBlur()"> + (blur)="inputBlur()" + (focus)="inputFocus()">
From e4c5043a7b8ccfbe9b9c8b274b67364cd1f5fef4 Mon Sep 17 00:00:00 2001 From: Karamath Date: Fri, 31 Aug 2018 12:44:19 +0100 Subject: [PATCH 2/2] RDM-2468: Updated the release version number --- RELEASE-NOTES.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index d6b668f5df..d249e1279b 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,9 @@ ## RELEASE NOTES +### Version 1.2.4 - August 31 2018 +**RDM-2468** Bug: +- Date field error correction + ### Version 1.2.3 - August 24 2018 - New publishing key diff --git a/package.json b/package.json index 984e8cdf56..d523254f15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "1.2.3", + "version": "1.2.4", "description": "Case UI Toolkit", "main": "./dist/index.umd.js", "module": "./dist/index.js",