Skip to content

Commit

Permalink
Merge pull request #57 from SylarLong/feat-56
Browse files Browse the repository at this point in the history
🪄 return yearly decorative stars
  • Loading branch information
SylarLong authored Sep 28, 2023
2 parents 576bc34 + 69eb82e commit dd7989f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/astro/FunctionalAstrolabe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/calendar/heavenlyStemAndEarthlyBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const getHeavenlyStemAndEarthlyBranchByLunarDate = (
* @returns HeavenlyStemAndEarthlyBranchResult
*/
export const getHeavenlyStemAndEarthlyBranchBySolarDate = (
dateStr: string,
dateStr: string | Date,
timeIndex: number,
): HeavenlyStemAndEarthlyBranchDate => {
const lunarDate = solar2lunar(dateStr);
Expand Down
2 changes: 1 addition & 1 deletion src/data/types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export type Horoscope = {
name: string;
};
/** 流年 */
yearly: HoroscopeItem;
yearly: HoroscopeItem & { yearlyDecStar: { jiangqian12: StarName[]; suiqian12: StarName[] } };
/** 流月 */
monthly: HoroscopeItem;
/** 流日 */
Expand Down
2 changes: 1 addition & 1 deletion src/star/decorationStar.ts → src/star/decorativeStar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/star/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

0 comments on commit dd7989f

Please sign in to comment.