/** * 日期格式化 - 基于 Intl.DateTimeFormat * * 禁止硬编码 'YYYY-MM-DD' 等格式模板 * 完全依赖 Intl API 做本地化日期展示 */ export interface FormatDateOptions { /** BCP 47 语言标签,默认从浏览器读取 */ locale?: string; /** 日期风格:'full' | 'long' | 'medium' | 'short' */ dateStyle?: 'full' | 'long' | 'medium' | 'short'; /** 时间风格:'full' | 'long' | 'medium' | 'short' */ timeStyle?: 'full' | 'long' | 'medium' | 'short'; /** 时区 */ timeZone?: string; } /** * 格式化日期 * * @param date - Date 对象或时间戳 * @param options - 格式化选项 * @returns 格式化后的日期字符串 * * @example * ```typescript * formatDate(new Date(), { dateStyle: 'medium', locale: 'zh-CN' }); * // => "2024年3月15日" * * formatDate(new Date(), { dateStyle: 'short', locale: 'en-US' }); * // => "3/15/24" * ``` */ export declare function formatDate(date: Date | number | string, options?: FormatDateOptions): string; /** * 格式化相对时间(如 "3 分钟前") * * @param date - Date 对象或时间戳 * @param locale - BCP 47 语言标签 * @returns 相对时间字符串 */ export declare function formatRelativeTime(date: Date | number, locale?: string): string; //# sourceMappingURL=date.d.ts.map