UNPKG

@storm-stack/date-time

Version:

This package includes a DateTime class, various utility functions for working with dates and times, and a number of formatting options.

36 lines (35 loc) 948 B
import { DateInput, type Format } from "@formkit/tempo"; export type FormatDateOptions = { /** * Should an empty string be returned if the date is null or undefined * * @defaultValue false */ returnEmptyIfNotSet?: boolean; /** * Should an empty string be returned if the date is invalid * * @defaultValue false */ returnEmptyIfInvalid?: boolean; /** * The format to use when generating the string * * @remarks * For more information read the [Tempo documentation](https://tempo.formkit.com/#format-tokens) * * @defaultValue "M/D/YYYY" */ format?: Format; /** * The locale used in the formatting */ locale?: string; }; /** * Format a date field * * @param dateTime - The date time to format * @returns The formatted date */ export declare const formatDate: (dateTime?: DateInput | null, options?: FormatDateOptions) => string;