Ensure time to int returns an integer

pull/6294/head
Chocobozzz 2024-03-27 09:04:34 +01:00
parent 4a35e6587a
commit ca889dbbb8
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 1 additions and 1 deletions

View File

@ -49,7 +49,7 @@ export const timecodeRegexString = `(\\d+[h:])?(\\d+[m:])?\\d+s?`
function timeToInt (time: number | string) {
if (!time) return 0
if (typeof time === 'number') return time
if (typeof time === 'number') return Math.floor(time)
// Try with 00h00m00s format first
const reg = new RegExp(`^((?<hours>\\d+)h)?((?<minutes>\\d+)m)?((?<seconds>\\d+)s?)?$`)