fix: resolve compilation errors in frontend and backend
This commit is contained in:
@@ -36,12 +36,7 @@
|
||||
let loading = $state(true);
|
||||
let serviceErrors = $state<Record<string, string>>({});
|
||||
|
||||
function validateDuration(val: any, field: string) {
|
||||
if (typeof val !== 'number' || val < 0) return 'Duration must be a positive number';
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
function validatePrice(price: any): string {
|
||||
const numPrice = parseFloat(price);
|
||||
if (isNaN(numPrice)) {
|
||||
return 'Price must be a valid number';
|
||||
@@ -52,7 +47,7 @@
|
||||
}
|
||||
|
||||
const decimalRegex = /^\d+(\.\d{1,2})?$/;
|
||||
if (!decimalRegex.test(price)) {
|
||||
if (!decimalRegex.test(price.toString())) {
|
||||
return 'Price can have up to 2 decimal places';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user