Created
September 29, 2020 16:21
-
-
Save alexalannunes/b496a863b9909670893c55d243de2278 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hour_to_decimal(time) { | |
const [hour, min] = time.split(':'); | |
const h = parseInt(hour); | |
const m = parseFloat(min); | |
return h + (m * (1/60)); | |
} | |
hour_to_decimal('03:75'); | |
// 4.25 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment