@ilihub/year
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@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


Package Sidebar

Install

npm i @ilihub/year

Weekly Downloads

24

Version

1.0.1

License

MIT

Unpacked Size

12 kB

Total Files

5

Last publish

Collaborators

  • harshraj8843