@ribajs/luxon
Version:
Luxon (time library) module for Riba.js
18 lines (16 loc) • 511 B
text/typescript
import { Formatter } from "@ribajs/core";
import { DateTime } from "luxon";
/**
* Returns a string representation of this DateTime appropriate for use in SQL Date
*/
export const LuxonToSQLDateFormatter: Formatter = {
name: "lx-to-sql-date",
/**
* @see https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html#instance-method-toSQLDate
* @param target can be a Luxon DateTime object
* @returns string | null
*/
read(target: DateTime) {
return target.toSQLDate();
},
};