import { IanaZone } from '../../../../types'; import { DateFormatPreset, TimeFormatPreset } from './presets'; /** * Date format preset options for dateTimeFormatter */ export type DateTimeFormatDatePreset = DateFormatPreset; /** * Time format preset options for dateTimeFormatter */ export type DateTimeFormatTimePreset = TimeFormatPreset | "none"; /** * Options type for the date-time formatter function */ export type DateTimeFormatterOptions = { /** * The locale to use for the date-time formatter * @default "en-US" */ locale?: Intl.LocalesArgument; /** * The format preset for the date portion or Intl.DateTimeFormatOptions object * - "short": 01/15/2024 * - "medium": Jan 15, 2024 * - "long": January 15, 2024 * - "full": Monday, January 15, 2024 * - Intl.DateTimeFormatOptions: Custom format (e.g., { weekday: "long", month: "short", day: "numeric" }) * @default "short" */ dateFormat?: DateTimeFormatDatePreset | Intl.DateTimeFormatOptions; /** * The format preset for the time portion or Intl.DateTimeFormatOptions object * - "short": 08:30 AM * - "medium": 08:30:00 AM * - "none": Omit time from display (useful for Date objects when you only want the date) * - Intl.DateTimeFormatOptions: Custom format (e.g., { hour: "2-digit", minute: "2-digit", hour12: false }) * @default "short" */ timeFormat?: DateTimeFormatTimePreset | Intl.DateTimeFormatOptions; /** * The IANA timezone to use for displaying Date objects (e.g., "America/New_York", "Europe/London", "UTC"). * If not provided, uses the user's local timezone. * * **Note:** This option only applies to `Date` objects. For string inputs, timezone handling is automatic: * - Strings without timezone info (e.g., "2024-01-15T09:30:00") are treated as plain date-times with no conversion * - Strings with timezone info (e.g., "2024-01-15T09:30:00Z" or "2024-01-15T09:30:00-05:00") use their embedded timezone * * @default undefined (local timezone) */ timeZone?: IanaZone; }; /** * Helper function for formatting table cells with date and time, including i18n support. * * For string inputs: * - Strings without timezone info are treated as "plain date-times" (no timezone conversion, no timezone displayed) * - Strings with timezone info (Z or offset) honor the provided timezone and display it (e.g., "PST", "UTC") * * For Date objects: * - Uses local timezone by default and displays the timezone * - Use the `timeZone` option to specify a different timezone (e.g., "America/New_York", "UTC") * * @param value - The date-time value to format (ISO string "YYYY-MM-DDTHH:mm:ss" or Date object) * @param options - The options for the date-time formatter * @returns The formatted date-time string or null for undefined/null values */ export declare const dateTimeFormatter: (value?: string | Date | null, { locale, dateFormat, timeFormat, timeZone, }?: DateTimeFormatterOptions) => string | null;