2022-01-04 15:43:56 +13:00
2022-01-04 15:43:56 +13:00
2022-01-04 15:43:56 +13:00
2022-01-04 15:43:56 +13:00
2022-01-04 15:43:56 +13:00
2016-04-03 13:34:45 +12:00
2022-01-04 15:43:56 +13:00
2016-07-30 12:34:09 +12:00

pretty-seconds

Build Status

a very simple function to stringify any huge number of seconds. give it million seconds and it tells you how many days, hours, minutes and seconds in a pretty string.

installation

to install pretty-seconds, use npm:

$ npm install pretty-seconds

then in your node.js app, get reference to the function like that:

var prettySeconds = require('pretty-seconds');

quick examples

make a pretty string out of 80 seconds


// outputs "1 minute and 20 seconds"
echo prettySeconds(80);

make a pretty string out of 86462 seconds


// outputs "1 day, 1 minute and 2 seconds"
echo prettySeconds(86462);

you see, it's really pretty and respects grammar for singular and plural.

api

prettySeconds(seconds)

all this function does is some maths and string concenations to have a pretty string instead of a long number of seconds.

arguments

  • seconds - any positive or negative number (integer or float) you fancy

license

MIT

Description
translation to spanish of pretty-seconds (used in Vinci) ⚠️ ARCHIVED: Original GitHub repository no longer exists. Preserved as backup on 2026-05-01T16:07:21.510Z
Readme MIT 51 KiB