Skip to main content
Home

latest

Utility for doing math on strings in the format "hh:mm", such as adding, subtracting, intersection testing and modulo

This package works with Node.js, Deno, Bun, BrowsersIt is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
94%
Published
a year ago (0.1.2)
variable HM

Symbol added as a property on all strings. Use this as the most convenient way to convert a plain string to an HHMM object.

Examples

Example 1

import { HM } from "@revosw/hhmm"
const from = "10:00"
const duration = "02:00"
const to = "12:00"
if (from[HM].add(duration) > to[HM]) {
  throw new Error("From + duration cannot be greater than to")
}

Type

unique symbol

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@revosw/hhmm

Import symbol

import { HM } from "@revosw/hhmm";
or

Import directly with a jsr specifier

import { HM } from "jsr:@revosw/hhmm";

Add Package

pnpm i jsr:@revosw/hhmm
or (using pnpm 10.8 or older)
pnpm dlx jsr add @revosw/hhmm

Import symbol

import { HM } from "@revosw/hhmm";

Add Package

yarn add jsr:@revosw/hhmm
or (using Yarn 4.8 or older)
yarn dlx jsr add @revosw/hhmm

Import symbol

import { HM } from "@revosw/hhmm";

Add Package

vlt install jsr:@revosw/hhmm

Import symbol

import { HM } from "@revosw/hhmm";

Add Package

npx jsr add @revosw/hhmm

Import symbol

import { HM } from "@revosw/hhmm";

Add Package

bunx jsr add @revosw/hhmm

Import symbol

import { HM } from "@revosw/hhmm";