0.1.0 • Published 2 years ago

icetool v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Table of contents

Installation

npm i icetool

Examples

import IceTools from 'icetool'; //Define the icetool module

Class NumberDateFormat

import { NumberDateFormat } from 'icetool';

const dateFormat = new NumberDateFormat("us-US", {format: "MMMM Do YYYY, hh:mm:ss"});
dateFormat.format(Date.now()); // June 19th 2022, 18:05:01

Class NumberFormat

import { NumberFormat } from 'icetool';

const compactNumberShort = new NumberFormat("us-US", {compactDisplay: "short", decimalNumber: 3, style: "none"});
compactNumberShort.format(1234567.891011); // 1.235M

const compactNumberLong = new NumberFormat("us-US", {compactDisplay: "long", decimalNumber: 3, style: "none"});
compactNumberLong.format(1234567.891011); // 1,234,567.891

const romanNumber = new NumberFormat("us-US", {style: "roman"});
romanNumber.format("XVII"); // 17
romanNumber.format(2408); // MMCDVIII
romanNumber.format(16780); // ↂↁMDCCLXXX

Class NumberTimeFormat

import { NumberTimeFormat } from 'icetool';

const shortTime = new NumberTimeFormat("us-US", {compactDisplay: "short", format: "End: HMS", separator: ", "});
shortTime.format(3738293); //  End: 1h, 2m, 18s

const yearsTime = new NumberTimeFormat("us-US", {compactDisplay: "long", format: "Y MM W D H M S MS", separator: " |"});
yearsTime.format(Date.now()); //  52 years | 5 months | 2 weeks | 3 days | 21 hours | 44 minutes | 23 seconds | 528 milliseconds

const longTime = new NumberTimeFormat("us-US", {compactDisplay: "long"});
longTime.format("2h and 8m with 20s add 2day ... oh and 80ms"); // 180500080

Discord

Join the Discord

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago