spotify-style-times

1.1.0 • Public • Published

spotify-style-times

Generate Spotify-style timestamps like '5m' and '3h'. Always selects the most minimalist approximation of the time (ie. largest unique unit of time). Supports timing down to the millsecond.

Install

yarn install spotify-style-times

Usage

See src/example.js for a full example.

import spotifyStyleTime from 'spotify-style-times';
import moment from 'moment';

let exampleDate = moment().subtract(2, 'm');
spotifyStyleTime(exampleDate); // 2m

Readme

Keywords

Package Sidebar

Install

npm i spotify-style-times

Weekly Downloads

0

Version

1.1.0

License

GPL-3.0

Unpacked Size

4.03 kB

Total Files

4

Last publish

Collaborators

  • liamzebedee