JSFiddle - React, Tailwind, and code Playground

by LeeMellinger

JavaScript

function timeToDecimal(t) {
    var arr = t.split(':');
    var dec = parseInt((arr[1]/6)*10, 10);
    
    return parseFloat(parseInt(arr[0], 10) + '.' + (dec<10?'0':'') + dec);
}   

console.log( timeToDecimal('36:30') ); // 0.01