Skip to content

Commit

Permalink
Merge pull request #25723 from GItGudRatio/fix/25514-rate-regex
Browse files Browse the repository at this point in the history
fix: allow decimal values without integer in reimbursement amount
  • Loading branch information
amyevans authored Aug 23, 2023
2 parents 9a0dd42 + a997962 commit 867d61e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/workspace/reimburse/WorkspaceRateAndUnitPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class WorkspaceRateAndUnitPage extends React.Component {
validate(values) {
const errors = {};
const decimalSeparator = this.props.toLocaleDigit('.');
const rateValueRegex = RegExp(String.raw`^\d{1,8}([${getPermittedDecimalSeparator(decimalSeparator)}]\d{1,3})?$`, 'i');
if (!rateValueRegex.test(values.rate)) {
const rateValueRegex = RegExp(String.raw`^\d{0,8}([${getPermittedDecimalSeparator(decimalSeparator)}]\d{1,3})?$`, 'i');
if (!rateValueRegex.test(values.rate) || values.rate === '') {
errors.rate = 'workspace.reimburse.invalidRateError';
}
return errors;
Expand Down

0 comments on commit 867d61e

Please sign in to comment.