Is it possible to display the highest expanded whole number metric time with Javascript code,
For an application, I want to display a time but instead of having a set metric (hour, min or second) it's flexible and I want to display the highest expanded metric given a time value. The input would be in seconds, and if there's a value that exceeds 3 digits I want it to be converted to the next unit, so for example
Input: 1500s
Output: 25mins
Reason: In its most expanded form it would be 25mins
Input: 3245155s
Output: 90hrs
Reason: In its most expanded form it would be 90hrs because in mins it would be 5409 which exceeds my 3 digit limit for a whole number.
Input: 34s
Output: 34s
Reason: In its most expanded form it would remain 34s as it is still within my 3 digit range
I know it's possible to write an algorithm for this, but instead of reinventing the wheel I'd just like to know if this functionality is built-in Javascript