Filter invalid time

This commit is contained in:
YY 2021-01-24 17:51:37 +08:00
parent f5825cc263
commit a3471b4f1d

View File

@ -133,20 +133,18 @@ var mainWindow = {
} }
}, },
'getTime': function (timeString) { 'getTime': function (timeString) {
ans = [] let num;
number = "" const timeRegex = new RegExp(/^\d[\da-z]*[a-z]$/);
for (var i of timeString) { return timeRegex.test(timeString)
if (i >= "0" && i <= "9") { ? [...timeString].reduce((res, c) => {
number = i if (Number.isInteger(+c)) {
} else if (i >= "a" && i <= "z") { num = c;
ans.push(number + i) return res;
} } else {
else { return [...res, num + c];
ans.push(timeString) }
break }, [])
} : [];
}
return ans
}, },
'select': function (department) { 'select': function (department) {
this.selectDepartment = department this.selectDepartment = department
@ -349,4 +347,4 @@ var mainWindow = {
</div> </div>
</div> </div>
` `
} }