UNPKG

@ribajs/luxon

Version:

Luxon (time library) module for Riba.js

18 lines (16 loc) 559 B
import { Formatter } from "@ribajs/core"; import { DateTime, ToISODateOptions } from "luxon"; /** * Returns an ISO 8601-compliant string representation of this DateTime's date component */ export const LuxonToISODateFormatter: Formatter = { name: "lx-to-iso-date", /** * @see https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html#instance-method-toISODate * @param target can be a Luxon DateTime object * @param opts Object */ read(target: DateTime, opts?: ToISODateOptions) { return target.toISODate(opts); }, };