@tangju/timezone-detector
Version:
🌍 A powerful TypeScript utility to detect and format current timezone information with multiple output formats
40 lines • 1.2 kB
TypeScript
/**
* 时区信息接口
*/
export interface TimezoneInfo {
/** 时区标识符 (如: Asia/Shanghai) */
identifier: string;
/** 时区缩写 (如: CST) */
abbreviation: string;
/** UTC偏移量(分钟) */
offsetMinutes: number;
/** UTC偏移量字符串 (如: +08:00) */
offsetString: string;
/** 是否为夏令时 */
isDST: boolean;
/** 当前时间 */
currentTime: Date;
}
/**
* 获取当前时区信息
* @returns 包含完整时区信息的对象
*/
export declare function getCurrentTimezone(): TimezoneInfo;
/**
* 格式化输出时区信息
* @param format 输出格式: 'simple' | 'detailed' | 'json'
* @returns 格式化的时区信息字符串
*/
export declare function formatTimezone(format?: 'simple' | 'detailed' | 'json'): string;
/**
* 直接打印当前时区信息到控制台
* @param format 输出格式
*/
export declare function printTimezone(format?: 'simple' | 'detailed' | 'json'): void;
declare const _default: {
getCurrentTimezone: typeof getCurrentTimezone;
formatTimezone: typeof formatTimezone;
printTimezone: typeof printTimezone;
};
export default _default;
//# sourceMappingURL=index.d.ts.map