@ribajs/luxon
Version:
Luxon (time library) module for Riba.js
19 lines (17 loc) • 597 B
text/typescript
import { Formatter } from "@ribajs/core";
import { Interval, ToISOTimeOptions } from "luxon";
/**
* Returns an ISO 8601-compliant string representation of time of this Interval.
*/
export const LuxonIntervalToISOTimeFormatter: Formatter = {
name: "lx-interval-to-iso-time",
/**
* @see https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html#instance-method-toISOTime
* @param target Interval
* @param opts ToISOTimeOptions | undefined
* @returns string
*/
read(target: Interval, opts?: ToISOTimeOptions): string {
return target.toISOTime(opts);
},
};