diff --git a/studio/schemas/objects/compensations/pension.ts b/studio/schemas/objects/compensations/pension.ts index 7ad763c50..d7345b407 100644 --- a/studio/schemas/objects/compensations/pension.ts +++ b/studio/schemas/objects/compensations/pension.ts @@ -6,7 +6,10 @@ export const pension = defineField({ type: "number", initialValue: 7, description: `Specify the percentage of the pension provided by Variant for employees. The value should be a positive number and will be used to calculate the pension amount.`, - validation: (Rule) => + validation: (Rule) => [ + Rule.min(0) + .max(100) + .error("The pension percentage must be a number between 0 and 100."), Rule.custom((value, context) => { if ( context.document?.showSalaryCalculator && @@ -14,9 +17,7 @@ export const pension = defineField({ ) { return "Please enter a pension percentage. This is required when the salary calculator is enabled."; } - if (value !== undefined && (value < 0 || value > 100)) { - return "The pension percentage must be a number between 0 and 100."; - } return true; }), + ], });