Created
December 6, 2018 08:36
-
-
Save ahafidi/5f9d235b0f69e6f376dc471b53d1c62f to your computer and use it in GitHub Desktop.
Tiny JS snippet to convert time formatted as 'HH:MM:SS' to seconds
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
| const seconds = time => time // formatted as 'HH:MM:SS' | |
| .split(':') | |
| .reverse() | |
| .reduce((acc, val, i) => acc + val * 60 ** i, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment