@ribajs/luxon
Version:
Luxon (time library) module for Riba.js
32 lines (30 loc) • 766 B
text/typescript
import { Formatter } from "@ribajs/core";
import { DateTime } from "luxon";
/**
* Gets a luxon date from a list of numerical arguments (year, month, day, ..., millisecond).
* @see https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html#static-method-local
*/
export const LuxonLocalFormatter: Formatter = {
name: "lx-local",
/**
* @param year number
* @param month number
* @param day number
* @param hour number
* @param minute number
* @param second number
* @param millisecond number
* @returns DateTime
*/
read([
year,
month,
day,
hour,
minute,
second,
millisecond,
]: number[]): DateTime {
return DateTime.local(year, month, day, hour, minute, second, millisecond);
},
};