@ribajs/luxon
Version:
Luxon (time library) module for Riba.js
18 lines (16 loc) • 518 B
text/typescript
import { Formatter } from "@ribajs/core";
import { Interval } from "luxon";
/**
* Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'.
*/
export const LuxonIntervalIsValidFormatter: Formatter = {
name: "lx-interval-is-valid",
/**
* @see https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html#instance-get-isValid
* @param target Interval
* @returns boolean
*/
read(target: Interval): boolean {
return target.isValid;
},
};