declare const UNITS: { ms: string; s: string; m: string; h: string; d: string; w: string; M: string; q: string; y: string; lh: string; ld: string; lM: string; ly: string; ch: string; cd: string; cM: string; cy: string; }; /** * 用于解析时间字符串的正则 */ declare const REGEX_PARSE: RegExp; /** * 一天共有多少毫秒 */ declare const DAY_MS: number; declare const JDN_1970 = 2440587.5; /** * 方法缓存装饰器,对方法取得的数据进行缓存 * @param cacheKey 缓存的key * @param isArgsAffectKey 是否根据参数不同决定key不同 */ declare function cache(cacheKey: string, isArgsAffectKey?: boolean): MethodDecorator; type GreUnitFullName = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; type LunarUnitFullName = 'lunarHour' | 'lunarDay' | 'lunarMonth' | 'lunarYear'; type LunarUnitFullNameLower = 'lunarhour' | 'lunarday' | 'lunarmonth' | 'lunaryear'; type Char8UnitFullName = 'char8Hour' | 'char8Day' | 'char8Month' | 'char8Year'; type Char8UnitFullNameLower = 'char8hour' | 'char8day' | 'char8month' | 'char8year'; type GreUnitShortName = 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'q' | 'y'; type LunarUnitShortName = 'lh' | 'ld' | 'lM' | 'ly'; type GreUnit = GreUnitFullName | GreUnitShortName; type LunarUnit = LunarUnitFullName | LunarUnitShortName | LunarUnitFullNameLower; type Char8Unit = Char8UnitFullName | Char8UnitFullName | Char8UnitFullNameLower; type UnitFullNameLower = GreUnitFullName | LunarUnitFullNameLower | Char8UnitFullNameLower; type Unit = GreUnit | LunarUnit | Char8Unit; type DateConfigType = string | number | Date | null | undefined; type DateParamType = DateConfigType | { toDate(): Date; [key: string]: any; }; type YMDH = 'year' | 'month' | 'day' | 'hour'; type YMD = 'year' | 'month' | 'day'; type DateDict = { year: number; month: number; day: number; hour: number; minute: number; second: number; millisecond?: number; }; type DateDictYMD = Pick; type DateDictPart = DateDictYMD & Partial>; type JDDict = { jdn: number; jdms?: number; }; /** * 处理日期单位 * @param unit */ declare const prettyUnit: (unit?: Unit) => UnitFullNameLower | ''; /** * 天干納甲 通過天干取得八卦 ``` 乾纳甲壬,坤纳乙癸, 震纳庚,巽纳辛, 坎纳戊,离纳己, 艮纳丙,兑纳丁 ``` * @param stemValue 天干索引 * @returns 返回八卦索引值 */ declare const getTrigramValueByStem: (stemValue: number) => number; /** * 通过天干和地支索引值,计算60个天干地支组合的索引 * @param stemValue 天干索引值 * @param branchValue 地支索引值 */ declare const computeSBValue: (stemValue: number, branchValue: number) => number; /** * 五鼠遁计算天干 ``` ---- 五鼠遁 --- 甲己还加甲,乙庚丙作初。 丙辛从戊起,丁壬庚子居。 戊癸起壬子,周而复始求。 ``` * @param fromStemValue 起始天干value (计算时柱天干则此处应为日柱天干) * @param branchValue 目标地支value (计算时柱天干,时处应为时柱地支) * @returns 返回目标地支的天干value */ declare function computeRatStem(fromStemValue: number, branchValue?: number): number; /** * 计算地支的三合五行 * @param branchValue 地支value值 * @returns 返回五行属性的索引值 */ declare const computeTriadE5Value: (branchValue: number) => number; /** * 计算地支六合五行 * @param branchValue 地支value值 * @returns 返回五行属性的索引值 */ declare const computeGroup6E5Value: (branchValue: number) => number; declare function dateDict2jdms(d: DateDict, isUTC?: boolean): number; declare function jdms2hms(jdms: number): Pick, 'hour' | 'minute' | 'second' | 'millisecond'>; declare function modDayMs(jdms: number, addValue?: number): number; /** * Gregorian calendar to Julian Day Number * 公历转儒略日数 * * @param date Gregorian calendar date * @param isUTC is UTC * @returns Julian Day Number */ declare function gre2jdn(date?: Date | Partial, isUTC?: boolean): number; /** * Juilan Day Number to Gregorian calendar * @param jdn Julian Day Number * @param isUTC is UTC * @returns Gregorian calendar date dict */ declare function jdn2dateDict(jdn: number, isUTC?: boolean, jdms?: number): Required; /** * jdn to timestamp * @param jdn Julian Day Number * @returns timestamp */ declare function jdn2timestamp(jdn: number): number; /** * timestamp to jdn * @param t timestamp * @returns Julian Day Number */ declare function timestamp2jdn(t: number): number; /** * jdn dict to timestamp * @param jdDict Julian Day Number Dict * @returns timestamp */ declare function jdDict2timestamp(jdDict: JDDict): number; /** * timestamp to jdDict * @param jdDict Julian Day Number Dict * @returns timestamp */ declare function timestamp2jdDict(t: number): Required; /** * 转整数 * @param val 数值 */ declare function toInt(val: number): number; /** * 检查对象是否包含所有指定的属性 * @param target 目标对象 * @param props 指定的属性列表 */ declare function hasProps(target: object, props: string[]): boolean; /** * 把两个列表分别作为key为value合并成字典 * @param keyList key列表数组 * @param valueList value列表数组 */ declare function twoList2Dict(keyList: string[], valueList: T[]): { [key: string]: T; }; declare function isNumber(value: number | string): boolean; /** * 设置对象的所有属性为只读 * @param obj 对象 * @returns obj */ declare const setReadonly: (obj: T) => T; /** * 取得数字的小数部分 */ declare function getFractionalPart(val: number): number; interface LocaleData { name: string; leap: string; lunarYearUnit: string; lunarHourUnit: string; bigMonth: string; smallMonth: string; weekdays: string[]; months: string[]; weekdaysShort: string[]; monthsShort: string[]; weekdaysMin: string[]; /** * The lunar months name * * There are 12 items in the array, */ lunarMonths: string[]; /** * The lunar months alias 陰歷月份別名 * * There are 12 items in the array, */ lunarMonthsAlias: string[]; /** * The lunar days name * * There are 30 items in the array, */ lunarDays: string[]; /** * number (數字: like 〇一二三四五六七八九十) */ numerals: string[]; /** * Constellation name (星座) */ constellationName: string[]; /** * Solar term (二十四節氣) * * There are 24 items in the array, * * From Xiaohan to the end of winter solstice 始于小寒 終于冬至 */ solarTerm: string[]; /** * 季节 */ seasonName: string[]; seasonShortName?: string[]; /** * Heavenly stem 天干 * * There are 10 items in the array, */ stems: string[]; /** * Earthly Branches 地支 * * There are 12 items in the array, */ branchs: string[]; /** * Separator for combination of heavenly stem and earth branches 天干地支组合时的分隔符 */ stemBranchSeparator: string; /** * Chinese zodiac 十二生肖 * * There are 12 items in the array, */ chineseZodiac: string[]; /** * Five Elements 五行 * * There are 5 items in the array, * * like (木 火 土 金 水) */ fiveElements: string[]; /** * Eight Trigram 八卦 * * There are 8 items in the array, * * like (坤 震 坎 兌 艮 離 巽 乾) */ eightTrigram: string[]; /** * the phase of moon 月相 */ moonPhase: { 朔: string; 望: string; 弦: string; 晦: string; }; /** * the directions 四方八隅,按九宮數字順序 */ directions: string[]; /** * The format of the date */ formats: { LT: string; LTS: string; L: string; LL: string; LLL: string; LLLL: string; l: string; ll: string; lll: string; llll: string; }; /** * The meridiem (午夜) */ meridiem: null | ((hour: number, minute: number, isLowercase?: boolean) => string); [x: string]: any; } /** * 取得譯文 * @param key 譯文key */ declare function getTranslation(locale: U, key: string): T | string; /** * 定义语言包 * @param localeData 语言包数据 */ declare const defineLocale: (localeData: { [x: string]: any; name: string; }) => { [x: string]: any; name: string; }; declare const getDefaultDateDict: () => Required; /** * Date对象转为dateDict * @param date Date对象 * @returns dateDict */ declare function date2DateDict(date?: Date | Partial | number): Required; /** * 日期字符串转日期字典 * @param str 日期字符串 * @returns 日期字典对象 */ declare const string2DateDict: (str: string) => Required; /** * 日期字典对象转Date对象 * @param dateDict 日期字典对象 * @param isUTC 是否UTC * @returns Date对象 */ declare const dateDict2Date: (dateDict: DateDict, isUTC?: boolean) => Date; declare const dateDictYMD2Date: (dateDict: DateDictPart, isUTC?: boolean) => Date; /** * 转为日期对象 * @param date 日期字符串或日期对象 * @param isUTC 是否UTC时间 * @returns 返回日期对像 */ declare const parseDate: (date?: DateParamType, isUTC?: boolean) => Date; export { DAY_MS, DateDict, JDN_1970, REGEX_PARSE, UNITS, YMDH, cache, computeGroup6E5Value, computeRatStem, computeSBValue, computeTriadE5Value, date2DateDict, dateDict2Date, dateDict2jdms, dateDictYMD2Date, defineLocale, getDefaultDateDict, getFractionalPart, getTranslation, getTrigramValueByStem, gre2jdn, hasProps, isNumber, jdDict2timestamp, jdms2hms, jdn2dateDict, jdn2timestamp, modDayMs, parseDate, prettyUnit, setReadonly, string2DateDict, timestamp2jdDict, timestamp2jdn, toInt, twoList2Dict };