Skip to content

Commit

Permalink
updates to add a random character string to ID
Browse files Browse the repository at this point in the history
  • Loading branch information
StoneBenHMCTS committed Jan 31, 2025
1 parent 0f644b9 commit d87c2c8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.1.34-date-label-fix",
"version": "7.1.34-date-label-fix-v2",
"engines": {
"node": ">=18.19.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/ccd-case-ui-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.1.34-date-label-fix",
"version": "7.1.34-date-label-fix-v2",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class DateInputComponent implements ControlValueAccessor, Validator, OnIn
private hour: string;
private minute: string;
private second: string;
private randString: string;

public ngOnInit() {
if (this.mandatory && this.isDateTime) {
Expand Down Expand Up @@ -192,28 +193,31 @@ export class DateInputComponent implements ControlValueAccessor, Validator, OnIn

public dayId() {
const idString = `${this.id}`;
this.randString = `${Math.floor(Math.random() * (0 - 999 + 1)) + 0}`;
if (idString.includes("Date")) {
return `${this.id}-day`;
return `${this.id}${this.randString}-day`;
} else {
return `${this.id}Date-day`;
return `${this.id}Date${this.randString}-day`;
}
}

public monthId() {
const idString = `${this.id}`;
this.randString = `${Math.floor(Math.random() * (0 - 999 + 1)) + 0}`;
if (idString.includes("Date")) {
return `${this.id}-month`;
return `${this.id}${this.randString}-month`;
} else {
return `${this.id}Date-month`;
return `${this.id}Date${this.randString}-month`;
}
}

public yearId() {
const idString = `${this.id}`;
this.randString = `${Math.floor(Math.random() * (0 - 999 + 1)) + 0}`;
if (idString.includes("Date")) {
return `${this.id}-year`;
return `${this.id}${this.randString}-year`;
} else {
return `${this.id}Date-year`;
return `${this.id}Date${this.randString}-year`;
}
}

Expand Down

0 comments on commit d87c2c8

Please sign in to comment.