UNPKG

@ribajs/luxon

Version:

Luxon (time library) module for Riba.js

24 lines (22 loc) 677 B
import { Formatter } from "@ribajs/core"; import { Duration } from "luxon"; /** * Returns a string representation of this Duration formatted according to the specified format string. */ export const LuxonDurationToFormatFormatter: Formatter = { name: "lx-duration-to-format", /** * @see https://moment.github.io/luxon/docs/class/src/duration.js~Duration.html#instance-method-toFormat * @param target Duration * @param fmt string * @param opts DurationToFormatOptions | undefined * @returns string */ read( target: Duration, fmt: string, opts?: { floor?: boolean | undefined }, ): string { return target.toFormat(fmt, opts); }, };