sec-con
v0.0.1
Published
Converting the number of second to string in different format
Downloads
2
Readme
sec-con
Description
Converting the number of seconds to string in defferent formats. Supported formats:
H:M:S
H:M
M:S
H
M
S
Installation
npm install sec-con
Usage
const SecCon = require("sec-con");
const anHour = new SecCon(3600);
console.log(anHour.format("H:M:S")); // 1:00:00
console.log(anHour.format("H:M")); // 1:00
console.log(anHour.format("M:S")); // 60:00
console.log(anHour.format("H")); // 1
console.log(anHour.format("H:M:S", 2)); // 01:00:00
const twoHours = new SecCon("02:00", "H:M");
console.log(twoHours.format("H:M:S")); // 2:00:00
console.log(twoHours.format("H:M")); // 2:00
console.log(twoHours.format("H:M", 2)); // 02:00