JSFiddle - React, Tailwind, and code Playground

by Roland Doda

JavaScript

function get_hours(time) {
      const hours = time.split(':')[0]
      const mins = time.split(':')[1]
      return Number(Number(hours) + Number(mins / 60)).toPrecision(3)
    }
    
let time = '01:50:00'

console.log(get_hours(time))