Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ time Public

A fluent time expression utility library to use like `Time.in(1).Week`

License

Notifications You must be signed in to change notification settings

bepalo/time

Repository files navigation

πŸ† @bepalo/time

npm version jsr github tests CI license Vitest

A fluent time expression utility library for use like Time.in(1).Week.

πŸš€ Get Started

πŸ“₯ Installation

Node.js / Bun (npm / pnpm / yarn)

bun add @bepalo/time
# or
pnpm add @bepalo/time
# or
npm install @bepalo/time
# or
yarn add @bepalo/time

Deno

Import directly using the URL:

import { Time } from "npm:@bepalo/time";
// or
import { Time } from "jsr:@bepalo/time";

πŸ“¦ Basic Usage

import { Time } from "@bepalo/time";

// ----------------------------------------//
// So many ways to express time.           //
// ----------------------------------------//
Time.for(1).Day;
Time.every(5).Seconds;
Time.in(10).years.FromNow;
Time.before(5).days.from(Time.now());
Time.after(3).minutes.and(20).seconds.and(30).Milliseconds._ms;
Time.every(5).Days;
Time.for(5).hours.FromNow;
Time.after(3).minutes.and(45).Seconds;
Time.after(10).years.From(Time.now());
Time.before(5).weeks.from(Time.now())._h;
// ----------------------------------------
Time.after(3).Minutes; // 3 minutes in seconds
Time.after(3).minutes.and(20).Seconds;
Time.after(3).minutes.and(20).seconds.and(30).Milliseconds;
// ----------------------------------------
Time.for(1).year.and(1).week; // default is in seconds
Time.for(1).year.and(1).week.v; // in seconds
Time.for(1).year.and(2).weeks.val; // in seconds
Time.for(1).year.and(3).weeks.value; // in seconds
Time.for(1).year.and(3).weeks._; // in seconds
Time.for(1).year.and(4).weeks._ms; // in milliseconds
Time.for(1).year.and(5).weeks._s; // in seconds
Time.for(1).year.and(7).weeks._m; // in minutes
Time.for(1).year.and(8).weeks._h; // in hours
Time.for(1).year.and(9).weeks._d; // in days
Time.for(1).year.and(10).weeks._w; // in weeks
Time.for(1).year.and(11).weeks._y; // in years

πŸ•ŠοΈ Thanks and Enjoy

If you like this library and want to support then please give a star on GitHub.

πŸ’– Be a Sponsor

Fund me so I can give more attention to the products and services you liked.

Ko-fi Badge

About

A fluent time expression utility library to use like `Time.in(1).Week`

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published