@hmcts/ccd-case-ui-toolkit 6.13.11-welsh-form-validation-errors → 6.13.11-welsh-form-validation-errors-v2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3139,22 +3139,26 @@
3139
3139
  return '';
3140
3140
  }
3141
3141
  var fieldLabel = this.rpxTranslationPipe.transform(args);
3142
+ var errorMessage;
3142
3143
  if (keys[0] === 'required') {
3143
- return this.rpxTranslationPipe.transform('%FIELDLABEL% is required', { FIELDLABEL: fieldLabel });
3144
+ errorMessage = '%FIELDLABEL% is required';
3144
3145
  }
3145
3146
  else if (keys[0] === 'pattern') {
3146
- return this.rpxTranslationPipe.transform('The data entered is not valid for %FIELDLABEL%', { FIELDLABEL: fieldLabel });
3147
+ errorMessage = 'The data entered is not valid for %FIELDLABEL%';
3147
3148
  }
3148
3149
  else if (keys[0] === 'minlength') {
3149
- return this.rpxTranslationPipe.transform('%FIELDLABEL% is below the minimum length', { FIELDLABEL: fieldLabel });
3150
+ errorMessage = '%FIELDLABEL% is below the minimum length';
3150
3151
  }
3151
3152
  else if (keys[0] === 'maxlength') {
3152
- return this.rpxTranslationPipe.transform('%FIELDLABEL% exceeds the maximum length', { FIELDLABEL: fieldLabel });
3153
+ errorMessage = '%FIELDLABEL% exceeds the maximum length';
3153
3154
  }
3154
3155
  else if (value.hasOwnProperty('matDatetimePickerParse')) {
3155
- return this.rpxTranslationPipe.transform('The date entered is not valid. Please provide a valid date');
3156
+ errorMessage = 'The date entered is not valid. Please provide a valid date';
3156
3157
  }
3157
- return value[keys[0]];
3158
+ else {
3159
+ errorMessage = value[keys[0]];
3160
+ }
3161
+ return this.rpxTranslationPipe.transform(errorMessage, { FIELDLABEL: fieldLabel });
3158
3162
  };
3159
3163
  return FirstErrorPipe;
3160
3164
  }());