Parse to float instead of parse to int

This commit is contained in:
SileNce5k 2022-06-09 23:21:55 +02:00
parent 7bcb76cffb
commit 513f62a1cf
No known key found for this signature in database
GPG key ID: C507260E7F2583AD

View file

@ -1,7 +1,7 @@
module.exports = function(time){
let timeInSeconds = parseInt(time.slice(0, time.length - 1))
let timeInSeconds = parseFloat(time.slice(0, time.length - 1))
let letter = time.slice(time.length - 1)
if(!isNaN(letter)) return parseInt(time) * 60;
if(!isNaN(letter)) return parseFloat(time) * 60;
switch (letter.toUpperCase()) {
case "H":
timeInSeconds = timeInSeconds * 3600; // 3 600 000