import { formatPlainDate } from "https://deno.land/x/complaindate@v0.7.2/mod.ts";
Curry a function to get localized strings of its plain-date arguments.
The function is curried in 2 rounds, each setting a property:
Intl
locale, defaults to system's locale if not given.Intl
format options, defaults to "short" date-style if no options given.
Examples
Example 1
Example 1
const formatDate = formatPlainDate()(); // Use system's locale and default formatting options
const formatMonthAndDay = formatPlainDate("en")({ month: "long", day: "numeric" });
formatDate(PlainDate({ year: 2023 })); // "1/1/2023"
formatMonthAndDay(PlainDate({ year: 2023 })); // "January 1"
Returns
(options?: FormatPlainDateOptions) => (date: ComPlainDate) => string
A curried function that takes Intl
format options and returns the final curried function that operates on plain-dates