/** * Constructs a Date object from a numeric timestamp. * * @param timestamp - The numeric timestamp to convert. Can be in seconds, milliseconds, microseconds, or nanoseconds. * @returns A Date object representing the input timestamp. * * @remarks * This function automatically detects the timestamp format based on its length: * - If length > 16: Assumes nanoseconds (divides by 1e6 to convert to milliseconds) * - If length > 13: Assumes microseconds (divides by 1e3 to convert to milliseconds) * - If length > 10: Assumes milliseconds (uses as-is) * - Otherwise: Assumes seconds (multiplies by 1e3 to convert to milliseconds) * * @example * // Returns a Date object for January 1, 2023, 00:00:00 UTC * constructDateFromTimestampNumber(1672531200000); */ declare const constructDateFromTimestampNumber: (timestamp: number) => Date; /** * Converts a timestamp to a formatted date string. * * @param timestamp - The timestamp to convert. Can be a number (representing seconds, milliseconds, microseconds, or nanoseconds since epoch) or a string. * @returns A formatted date string in the 'en-GB' locale if the input is a number, or the original input if it's a string. * The formatted date string includes day, month, year, hour, minute, second, and timezone (UTC). * * @example * // Returns a formatted date string like "1 Jan 2023, 12:00:00 UTC" * timestampToDate(1672531200000); * * @example * // Returns the original string * timestampToDate("2023-01-01"); */ declare const timestampToDate: (timestamp: number | string) => string; /** * Converts a timestamp to a formatted date string without time information. * * @param timestamp - The timestamp to convert. Can be a number (representing seconds, milliseconds, microseconds, or nanoseconds since epoch) or a string. * @returns A formatted date string in the 'en-GB' locale if the input is a number, or the original input if it's a string. * The formatted date string includes day, month, and year. * * @example * // Returns a formatted date string like "1 Jan 2023" * timeStampToDateOnly(1672531200000); * * @example * // Returns the original string * timeStampToDateOnly("2023-01-01"); */ declare const timeStampToDateOnly: (timestamp: number | string) => string; /** * Converts a numeric timestamp to an ISO 8601 formatted date-time string without milliseconds. * * @param timestamp - The numeric timestamp to convert. Can be in seconds, milliseconds, microseconds, or nanoseconds. * @returns A string representing the date and time in ISO 8601 format (YYYY-MM-DDTHH:mm:ss), truncated to seconds. * * @example * // Returns "2023-01-01T00:00:00" * timestampToISOFormat(1672531200000); * * @remarks * This function uses the `constructDateFromTimestampNumber` helper to create a Date object, * then converts it to ISO format. The resulting string is truncated to remove milliseconds. * The output is always in UTC, regardless of the local timezone. */ declare const timestampToISOFormat: (timestamp: number) => string; /** * Converts a numeric timestamp to a formatted date string in "Month Day, Year" format. * * @param timestamp - The numeric timestamp to convert. Can be in seconds, milliseconds, microseconds, or nanoseconds. * @returns A string representing the date in "Month Day, Year" format (e.g., "Jan 01, 2023"). * * @example * // Returns "Jan 01, 2023" * timestampToMDYDate(1672531200000); * * @remarks * This function uses the `Intl.DateTimeFormat` API to format the date in US English locale. * It displays the month as a short string, the day as a two-digit number, and the year as a numeric value. * The function internally uses `constructDateFromTimestampNumber` to handle various timestamp formats. */ declare const timestampToMDYDate: (timestamp: number) => string; /** * Returns the current date in ISO 8601 format (YYYY-MM-DD). * * @returns A string representing the current date in ISO 8601 format. * * @example * // If today is May 15, 2023 * const today = getCurrentDateISO(); * console.log(today); // Outputs: "2023-05-15" * * @remarks * This function creates a new Date object representing the current date and time, * converts it to an ISO string, and then extracts only the date part (YYYY-MM-DD). * The time is based on the local system clock and is converted to UTC. */ declare const getCurrentDateISO: () => string; /** * Returns the date N days ago in ISO 8601 format (YYYY-MM-DD). * * @param n - The number of days to go back from the current date. * @returns A string representing the date N days ago in ISO 8601 format. * * @example * // If today is May 15, 2023 * const threeDaysAgo = getNDaysAgoISO(3); * console.log(threeDaysAgo); // Outputs: "2023-05-12" * * @remarks * This function creates a new Date object representing the current date, * subtracts the specified number of days, and then returns the resulting date * in ISO 8601 format (YYYY-MM-DD). The time is based on the local system clock * and is converted to UTC. */ declare const getNDaysAgoISO: (n: number) => string; export { constructDateFromTimestampNumber, getCurrentDateISO, getNDaysAgoISO, timestampToDate, timeStampToDateOnly, timestampToISOFormat, timestampToMDYDate, };