Skip to content

Commit 5e82bb6

Browse files
committed
fix: improve normalization function for better clarity and error handling
1 parent bf577c6 commit 5e82bb6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

adminforth/spa/src/components/CustomRangePicker.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ const maxFormatted = computed(() => {
5454
return isNaN(v) ? 100 : Math.ceil(v);
5555
});
5656
57-
const normalize = (val: any) => (val === "" || val === null || val === undefined) ? null : Number(val);
57+
const normalize = (val: any) => {
58+
if (val === "" || val === null || val === undefined) return null;
59+
const numericValue = Number(val);
60+
return isNaN(numericValue) ? null : numericValue;
61+
};
5862
5963
const start = ref<number | null>(normalize(props.valueStart));
6064
const end = ref<number | null>(normalize(props.valueEnd));

0 commit comments

Comments
 (0)