Skip to main content

Built and signed on GitHub Actions

format string with Python f-string or date command syntax

This package works with Bun, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Deno
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
76%
Published
3 months ago (1.0.3)
class DateLikeFormatter

date command like formatter

Special letter ('%' by default) followed by key letters will be replaced by corresponding formatted string.

This class is designed for formatting Date object, however, can work with other object as long as setting appropriate handlers, and can be useful when formatting multiple properties of a single object.

Constructors

new
DateLikeFormatter(
handlers: DateHanler<T>,
options?: DateOptions,
)

Create a new date command like formatter with given handlers and options.

Type Parameters

Methods

format(
msg: string,
v: T,
): string

Format string with date command like syntax

Create a new patched DateLikeFormatter<T>

This method doesn't modify this object itself, and creates new one with patch.

Add Package

deno add jsr:@ymd-h/format-js

Import symbol

import { DateLikeFormatter } from "@ymd-h/format-js";

---- OR ----

Import directly with a jsr specifier

import { DateLikeFormatter } from "jsr:@ymd-h/format-js";

Add Package

npx jsr add @ymd-h/format-js

Import symbol

import { DateLikeFormatter } from "@ymd-h/format-js";

Add Package

yarn dlx jsr add @ymd-h/format-js

Import symbol

import { DateLikeFormatter } from "@ymd-h/format-js";

Add Package

pnpm dlx jsr add @ymd-h/format-js

Import symbol

import { DateLikeFormatter } from "@ymd-h/format-js";

Add Package

bunx jsr add @ymd-h/format-js

Import symbol

import { DateLikeFormatter } from "@ymd-h/format-js";