2.0.1 • Published 2 years ago

hours-minutes-seconds v2.0.1

Weekly downloads
11
License
MIT
Repository
github
Last release
2 years ago

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)