import { GeneralSetting } from '../types/generalSettings.type'; /** * Represents a user. * * @property token - The user's authentication token. * @property generalSetting - The user's general settings. */ type User = { token: string; generalSetting: GeneralSetting; [key: string]: unknown; }; export type TDateFormat = 'd/m/yy' | 'm/d/yy' | 'd/mm/yy' | 'dd/mm/yy' | 'dd/mm/yyyy' | 'dd M yy' | 'dd M yyyy' | 'dd MM yy' | 'dd MM yyyy' | 'D dd M yy' | 'D dd M yyyy' | 'DD dd MM yy' | 'DD dd MM yyyy' | 'D, dd M yy' | 'D, dd M yyyy' | 'DD, dd MM yy' | 'DD, dd MM yyyy'; export type GoDateLayout = '02/01/06' | '_2/_1/06' | '_1/_2/06' | '02 Jan 06' | 'Mon, 02 Jan 06' | 'Mon, 02 Jan 2006'; export type TTimeFormat = 'HH:mm' | 'HH:mm a' | 'HH:mm:ss' | 'HH:mm:ss a'; export type GoTimeLayout = '15:04' | '03:04 PM' | '15:04:05' | '03:04:05 PM'; export type CustomDateTimeFormatOptions = Omit & { timezone?: string; locale?: string; }; export type DateOptions = { locale?: string; dateFormat?: TDateFormat | GoDateLayout; timeFormat?: TTimeFormat | GoTimeLayout; timezone?: string; /** * Show the time in the formatted date. * * @default false - But will be set to true when `DateOptions.timeFormat` is provided */ showTime?: boolean; /** * Show the date in the formatted date. * * @default true */ showDate?: boolean; /** * This is old format (general settings), if configuration still using old settings then this option parameter can be used */ formatPreset?: CustomDateTimeFormatOptions; }; export declare const getLoggedInUser: () => User; export declare const getUserLocale: () => string; export declare const formatGoDate: (date: Date, options?: DateOptions, useGeneralSettings?: boolean) => string; /** * Formats a date according to the user's general settings. * * @param date - The date to be displayed. Can be a Date object or a string in a recognized date format. * @param useTimeOrFormat - Whether to include the time in the formatted date string. Defaults to false. * @returns The formatted date string. */ export declare const formatDate: (date: Date | string | null | undefined, useTimeOrFormat?: boolean | DateOptions) => string; /** * Formats a date to human readable form (timeago / relative time from now). * * @param date - The date to be displayed. Can be a Date object or a string in a recognized date format. * @param maxSeconds - Max value of seconds difference. Use it for formats a date according to the user's general settings. * @returns The formatted date string. */ export declare const formatDateReadable: (date: Date | string, maxSeconds?: number) => string; export default formatDate;