UNPKG

iztro

Version:

轻量级紫微斗数星盘生成库。可以通过出生年月日获取到紫微斗数星盘信息、生肖、星座等信息。This is a lightweight kit for generating astrolabes for Zi Wei Dou Shu (The Purple Star Astrology), an ancient Chinese astrology. It allows you to obtain your horoscope and personality analysis.

34 lines (33 loc) 1.14 kB
import { LunarDate, SolarDate } from '../data/types'; /** * 将农历日期字符串拆分成年,月,日 * * @param dateStr 农历日期字符串 YYYY-MM-DD * @returns [年, 月, 日] * @example * normalizeLunarDateStr('2023-07-31'); // [2023, 7, 31] */ export declare const normalizeLunarDateStr: (dateStr: string) => number[]; /** * 将公历日期字符串拆分成年,月,日 * * @param dateStr 公历日期 * @returns [年, 月, 日] * @example * normalizeSolarDateStr('2023-07-31'); // [2023, 7, 31] */ export declare const normalizeSolarDateStr: (dateStr: string | Date) => number[]; /** * 公历转农历,年份需要在【1900~2100】之间,并且日期必须在1900-1-31之后 * * @param dateStr 公历日期 YYYY-MM-DD格式的字符串或者Date对象 * @returns LunarDate */ export declare const solar2lunar: (dateStr: string | Date) => LunarDate; /** * * @param dateStr 农历日期 YYYY-MM-DD * @param isLeapMonth 是否闰月,若该月不是闰月,会忽略该参数 * @returns SolarDate */ export declare const lunar2solar: (dateStr: string, isLeapMonth?: boolean) => SolarDate;