@shanecaf/duration-js@0.1.9
latest
Library for dealing with Durations. Uses Temporal Polyfill.
This package works with Node.js, BunIt is unknown whether this package works with Deno


JSR Score
100%
Published
2 months ago (0.1.9)
Duration.js
A library for handling durations that uses the Temporal proposal polyfill.
This is a fork of Duration.js by icholy based on the golang_compatible branch.
Example
import { Duration, DiscordTimestamp } from '@shanecaf/duration-js'; const duration = new Duration('1w 2d'); console.log(duration.endDate()); // Outputs a Date object. //Discord Timestamps: console.log(duration.toDiscordTimestamp(DiscordTimestamp.LongDateTime)); //Outputs <t:[date_in_epoch_sec]:F> for Discord.
Tests
Since this is a work in progress, there are no tests yet.
Add Package
deno add jsr:@shanecaf/duration-js
Import symbol
import * as duration_js from "@shanecaf/duration-js";
Import directly with a jsr specifier
import * as duration_js from "jsr:@shanecaf/duration-js";
Add Package
pnpm i jsr:@shanecaf/duration-js
pnpm dlx jsr add @shanecaf/duration-js
Import symbol
import * as duration_js from "@shanecaf/duration-js";
Add Package
yarn add jsr:@shanecaf/duration-js
yarn dlx jsr add @shanecaf/duration-js
Import symbol
import * as duration_js from "@shanecaf/duration-js";
Add Package
vlt install jsr:@shanecaf/duration-js
Import symbol
import * as duration_js from "@shanecaf/duration-js";
Add Package
npx jsr add @shanecaf/duration-js
Import symbol
import * as duration_js from "@shanecaf/duration-js";
Add Package
bunx jsr add @shanecaf/duration-js
Import symbol
import * as duration_js from "@shanecaf/duration-js";