/** * 日期时间相关的工具方法(无外部依赖) */ export declare function toDate(date: string | number | Date, defaults?: Date): Date; /** * 将给定时间日期按照指定格式格式化输出 -- 建议使用 moment().format 替代 * @param fmt 格式 * @param date 指定的日期。为 Date 类型,或 20180131 格式字符串、或可 new Date() 格式化的字符串 * @example * dateFormat('yyyy-MM-dd hh:mm:ss.S', new Date(1526895082375)); // 2018-05-21 17:31:22.375 */ export declare function dateFormat(fmt: string, date?: Date | string | number): string; /** * 秒数转换为相差时间 * @example * ```ts * arriveTimerFormat(123); => [0, 0, 2, 3, '00:02:03']; * arriveTimerFormat(1521580); // => [17, 14, 39, 40, '17day 14:39:40'] * ``` */ export declare function arriveTimerFormat(second: number | string, dayDesc?: string): readonly [number, number, number, number, string]; export declare function formatTimeCost(startTime: number, suffix?: string[]): string; /** * 格式化格式为 yyyyMMdd 或 yyyyMMddhhmmss 的日期字符串,输出为一个对象 * @param date 格式可为 20180131、20190419000000000 * @example * yyyyMMddFormat('20180101'); {year: '2018', month: '01', day: '01', str: '2018年01月01日', ...} * yyyyMMddFormat(''); // {year: '', month: '', day: '', str: '', ...} */ export declare function yyyyMMddFormat(dateStr: string | number): { year: string; month: string; day: string; hour: string; minute: string; second: string; millisecond: string; str: string; date: Date; dateStr(): string; }; /** * 按指定时区取得当前时间 * @param timeZone 指定的时区,默认为 0(北京市+8,美国华盛顿 -5) * @param now 指定的时间对象,默认为当前浏览器获取的时间 new Date() */ export declare function getDateTimeByTimeZone(timeZone?: number, now?: Date): Date; /** * 将指定时区的时间转换为当前浏览器的时间 * @param date 传入的(可被格式化的)时间 * @param timeZone 参数 date 所表示的时区,默认为北京时间东八区 */ export declare function toLocalTime(date: number | string | Date, timeZone?: number): Date | null; /** * 计算相差时间 * @param endTime 结束时间。格式:yyyyMMddhhmmss * @param startTime 起始时间。格式:yyyyMMddhhmmss */ export declare function getCostTime(endTime: string, startTime: string): number; /** * 将后台传过来的时间字符串转换为分号分隔显示的时间字符串 * @example * ```ts * formatIntToTime(140151); // => 14:01:51 * formatIntToTime(140151559); // => 14:01:51.559 * formatIntToTime(140151559, false); // => 14:01:51 * formatIntToTime(80151); // => 08:01:51 * formatIntToTime(80151559); // => 08:01:51.559 * formatIntToTime(80151559, false); // => 08:01:51 * ``` */ export declare function formatIntToTime(time: number | string | Date, withMillisecond?: boolean): string; export declare function toLocalISOString(date: Date): string;