UNPKG

@ribajs/luxon

Version:

Luxon (time library) module for Riba.js

19 lines (17 loc) 544 B
import { Formatter } from "@ribajs/core"; import { DateTime, DateTimeUnit } from "luxon"; /** * "Set" this DateTime to the beginning of a unit of time. */ export const LuxonStartOfFormatter: Formatter = { name: "lx-start-of", /** * @see https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html#instance-method-startOf * @param target can be a Luxon DateTime object * @param unit string * @returns DateTime */ read(target: DateTime, unit: DateTimeUnit): DateTime { return target.startOf(unit); }, };