Fix range numbers parsing

This commit is contained in:
Cohee 2024-03-15 16:31:43 +02:00
parent cda7ab0530
commit 508bab7e0f
1 changed files with 4 additions and 0 deletions

View File

@ -43,6 +43,10 @@ export function isValidUrl(value) {
export function stringToRange(input, min, max) { export function stringToRange(input, min, max) {
let start, end; let start, end;
if (typeof input !== 'string') {
input = String(input);
}
if (input.includes('-')) { if (input.includes('-')) {
const parts = input.split('-'); const parts = input.split('-');
start = parts[0] ? parseInt(parts[0], 10) : NaN; start = parts[0] ? parseInt(parts[0], 10) : NaN;