UNPKG

smartlink-format-time

Version:

smartlink-format-time

51 lines (50 loc) 1.65 kB
import { FormatDateTimeConfig } from "../typing"; export declare const getUtcVal: (timezone: string) => { timezoneSymbol: string; num: number; }; /** * 获取iso86 的日期时间 和 时区 */ export declare const getISO86DateAndTimezone: (val: string) => { dateTime: string; timezone: string; }; /** * 时间格式化 - iso86 * 不带逻辑直接转iso86格式 * 因为时区是系统设置的,所以会用到拼接的方式处理 */ export declare const onDateFormatISO86: (value: any, dateFormat?: string, timezone?: string) => string; /** * 将指定时区时间 转为 其它指定时区时间 * @支持日期时间类型格式 * 1. iso86 - 0000-00-00T00:00:00+00:00 * 2. 0000-00-00 00:00:00 * 3. 时间戳 * * @param dateVal - 时间字符串 * @param inputTimeZone - 传入date所属时区 * @param targetTimeZone - 目标时区 * @returns number - 时间戳 */ export declare const getUtcTimeStamp: ({ dateVal, inputTimeZone, targetTimeZone, }: { dateVal: any; inputTimeZone?: string | undefined; targetTimeZone?: string | undefined; }) => number; /** * 日期时间格式化 * @支持日期时间类型格式 * 1. iso86 - 0000-00-00T00:00:00+00:00 * 2. 0000-00-00 00:00:00 * 3. 时间戳 * * @param dateVal - 时间字符串 * @param dateFormat - 展示时间格式 * @param inputTimeZone - 传入date所属时区 * @param targetTimeZone - 目标时区 * @param isConvertTimeZone - 是否根据时区转换 * @returns 日期时间字符串 */ export declare const formatDateTime: (config: FormatDateTimeConfig) => string;