0.0.1 • Published 1 year ago

sec-con v0.0.1

Weekly downloads
-
License
GPLV3
Repository
-
Last release
1 year ago

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
0.0.1

1 year ago

1.0.0

1 year ago