Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

hours-minutes-seconds

Paul-Browne3MIT2.0.1TypeScript support: included

Consistant time rendering eg. 12:34:56 or 01:02:03

time, constant width, console log

readme

hours-minutes-seconds

constant width time eg. 12:34:56 or 03:02:01

usage

npm i hours-minutes-seconds

or

npm i -D hours-minutes-seconds

Called with no arguments, the time will be the current time.

import hms from 'hours-minutes-seconds';
console.log(hms());  // 09:15:27 (if the time was quarter past nine in the morning)

Alternatively pass a date object.

import hms from 'hours-minutes-seconds';
const timeIn30Minutes = new Date(+new Date() + 1.8e6);
console.log(hms(timeIn30Minutes));  // 09:45:27 (if the time was quarter past nine in the morning)