Skip to content

Commit

Permalink
FIO-8798: update validation format
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria-Golomb committed Aug 24, 2024
1 parent bdc64e2 commit 9e85e8c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/day/Day.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,16 @@ export default class DayComponent extends Field {
}

getValidationFormat() {
return this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
let validationFormat = this.dayFirst ? 'DD-MM-YYYY' : 'MM-DD-YYYY';
if (this.fields?.day?.hide) {
validationFormat = validationFormat.replace('DD-', '');
}
if (this.fields?.month?.hide) {
validationFormat = validationFormat.replace('MM-', '');
}
if ( this.fields?.year?.hide ) {
validationFormat = validationFormat.replace('-YYYY', '');
}
return validationFormat;
}
}

0 comments on commit 9e85e8c

Please sign in to comment.