1.0.1 • Published 6 months ago

@ilihub/year v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@ilihub/year

TypeScript functions for converting year to other time units.

NPM Version NPM CodeFactor Socket Badge

Installation

# if you're using pnpm
pnpm add @ilihub/year

# or, if you're using npm
npm install @ilihub/year

# or, if you're using yarn
yarn add @ilihub/year

Usage

import { Year } from "@ilihub/year";

const year = new Year(1);

const millisecond = year.toMillisecond();
console.log(millisecond); // 31536000000

const second = year.toSecond();
console.log(second); // 31536000

const minute = year.toMinute();
console.log(minute); // 525600

const hour = year.toHour();
console.log(hour); // 8760

const day = year.toDay();
console.log(day); // 365

const week = year.toWeek();
console.log(week); // 52

const month = year.toMonth();
console.log(month); // 12

const decade = year.toDecade();
console.log(decade); // 0.1

const century = year.toCentury();
console.log(century); // 0.01

Available Functions and Classes


Sponsors & Backers

Support the development of new open-source projects from ilihub through crowdfunding.

The core of ilihub is our crowd-funded open-source projects, licensed under the permissive MIT license. Sponsorship increases the rate of bug fixes, documentation improvements, and feature development.

Sponsors