sec-con

0.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i sec-con

Weekly Downloads

8

Version

0.0.1

License

GPLV3

Unpacked Size

51 kB

Total Files

7

Last publish

Collaborators

  • brianyau0309