diff --git a/src/astro/FunctionalAstrolabe.ts b/src/astro/FunctionalAstrolabe.ts index 8103d92d..9874a699 100644 --- a/src/astro/FunctionalAstrolabe.ts +++ b/src/astro/FunctionalAstrolabe.ts @@ -2,7 +2,7 @@ import { getHeavenlyStemAndEarthlyBranchBySolarDate, normalizeSolarDateStr, sola import { EARTHLY_BRANCHES } from '../data'; import { Astrolabe, Horoscope } from '../data/types'; import { EarthlyBranchKey, EarthlyBranchName, HeavenlyStemName, kot, PalaceName, StarKey, StarName, t } from '../i18n'; -import { getHoroscopeStar } from '../star'; +import { getHoroscopeStar, getYearly12 } from '../star'; import { IFunctionalStar } from '../star/FunctionalStar'; import { fixEarthlyBranchIndex, fixIndex, getMutagensByHeavenlyStem, timeToIndex } from '../utils'; import { getPalace, getSurroundedPalaces } from './analyzer'; @@ -123,6 +123,7 @@ const _getHoroscopeBySolarDate = ( palaceNames: getPalaceNames(yearlyIndex), mutagen: getMutagensByHeavenlyStem(yearly[0]), stars: getHoroscopeStar(yearly[0], yearly[1], 'yearly'), + yearlyDecStar: getYearly12(targetDate), }, monthly: { index: monthlyIndex, diff --git a/src/calendar/heavenlyStemAndEarthlyBranch.ts b/src/calendar/heavenlyStemAndEarthlyBranch.ts index cff29773..dc8cee6f 100644 --- a/src/calendar/heavenlyStemAndEarthlyBranch.ts +++ b/src/calendar/heavenlyStemAndEarthlyBranch.ts @@ -131,7 +131,7 @@ export const getHeavenlyStemAndEarthlyBranchByLunarDate = ( * @returns HeavenlyStemAndEarthlyBranchResult */ export const getHeavenlyStemAndEarthlyBranchBySolarDate = ( - dateStr: string, + dateStr: string | Date, timeIndex: number, ): HeavenlyStemAndEarthlyBranchDate => { const lunarDate = solar2lunar(dateStr); diff --git a/src/data/types/astro.ts b/src/data/types/astro.ts index 42707c4f..0840ff0d 100644 --- a/src/data/types/astro.ts +++ b/src/data/types/astro.ts @@ -82,7 +82,7 @@ export type Horoscope = { name: string; }; /** 流年 */ - yearly: HoroscopeItem; + yearly: HoroscopeItem & { yearlyDecStar: { jiangqian12: StarName[]; suiqian12: StarName[] } }; /** 流月 */ monthly: HoroscopeItem; /** 流日 */ diff --git a/src/star/decorationStar.ts b/src/star/decorativeStar.ts similarity index 98% rename from src/star/decorationStar.ts rename to src/star/decorativeStar.ts index b1423aaa..5f15ee24 100644 --- a/src/star/decorationStar.ts +++ b/src/star/decorativeStar.ts @@ -203,7 +203,7 @@ export const getJiangqian12StartIndex = (earthlyBranchName: EarthlyBranchName) = * @param solarDateStr 阳历日期字符串 * @returns 流年诸星从寅宫开始的顺序 */ -export const getYearly12 = (solarDateStr: string): { suiqian12: StarName[]; jiangqian12: StarName[] } => { +export const getYearly12 = (solarDateStr: string | Date): { suiqian12: StarName[]; jiangqian12: StarName[] } => { const jiangqian12: StarName[] = []; const suiqian12: StarName[] = []; const { yearly } = getHeavenlyStemAndEarthlyBranchBySolarDate(solarDateStr, 0); diff --git a/src/star/index.ts b/src/star/index.ts index e620576e..0ff07279 100644 --- a/src/star/index.ts +++ b/src/star/index.ts @@ -6,5 +6,5 @@ export * from './location'; export * from './majorStar'; export * from './minorStar'; export * from './adjectiveStar'; -export * from './decorationStar'; +export * from './decorativeStar'; export * from './horoscopeStar';