Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eoinsha/sixty-sixty

Sexagesimal absolute time formatting from a decimal seconds input
https://github.com/eoinsha/sixty-sixty

Last synced: 15 days ago
JSON representation

Sexagesimal absolute time formatting from a decimal seconds input

Awesome Lists containing this project

README

        

Sixty-Sixty
===

Ultra-simple formatting of absolute time given a decimal seconds floating-point input.

# Format
`[hh:]mm:ss.SSS`
- `hh` - hours (if `{ showHours: true }` in optioins)
- `mm` - minutes
- `ss` - seconds
- `SSS` - milliseconds

# Usage

```js
var SixtySixty = require('sixty-sixty')();
console.log(SixtySixty(0)); // --> '00:00.000'
console.log(SixtySixty(60)); // --> '01:00.000'
console.log(SixtySixty(666.6666)); // --> '11:06.667'
console.log(SixtySixty(6025.5432)); // --> '100:25.543'
```
```js
var SixtySixty = require('sixty-sixty')({ showHours: true });
console.log(SixtySixty(0)); // --> '00:00:00.000'
console.log(SixtySixty(60)); // --> '00:01:00.000'
console.log(SixtySixty(666.6666)); // --> '00:11:06.667'
console.log(SixtySixty(6025.5432)); // --> '01:40:25.543'
```